Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 76 additions & 3 deletions stdlib/_socket.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ _CMSGArg: TypeAlias = tuple[int, int, ReadableBuffer]
# Addresses can be either tuples of varying lengths (AF_INET, AF_INET6,
# AF_NETLINK, AF_TIPC) or strings/buffers (AF_UNIX).
# See getsockaddrarg() in socketmodule.c.
_Address: TypeAlias = tuple[Any, ...] | str | ReadableBuffer
_Address: TypeAlias = tuple[Any, ...] | str | ReadableBuffer | int
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above should be modified to explain why int is included.

_RetAddress: TypeAlias = Any

# ===== Constants =====
Expand All @@ -34,8 +34,76 @@ SOCK_SEQPACKET: Final[int]

if sys.platform == "linux":
# Availability: Linux >= 2.6.27
SOCK_CLOEXEC: Final[int]
SOCK_NONBLOCK: Final[int]
if sys.version_info >= (3, 14):
SOCK_CLOEXEC: Final[int]
SOCK_NONBLOCK: Final[int]
Comment on lines +38 to +39
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two should not be changed to have a condition on the Python version.

BDADDR_BREDR: Final[int]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect all of the Bluetooth stuff to be grouped together with the existing "semi-documented constants" below line 635.

# Semi-documented constants

Same comment applies to the Windows-only constants.

BDADDR_LE_PUBLIC: Final[int]
BDADDR_LE_RANDOM: Final[int]
BT_CHANNEL_POLICY: Final[int]
BT_CHANNEL_POLICY_BREDR_ONLY: Final[int]
BT_CHANNEL_POLICY_BREDR_PREFERRED: Final[int]
BT_CODEC: Final[int]
BT_DEFER_SETUP: Final[int]
BT_FLUSHABLE: Final[int]
BT_FLUSHABLE_OFF: Final[int]
BT_FLUSHABLE_ON: Final[int]
BT_ISO_QOS: Final[int]
BT_MODE: Final[int]
BT_MODE_BASIC: Final[int]
BT_MODE_ERTM: Final[int]
BT_MODE_EXT_FLOWCTL: Final[int]
BT_MODE_LE_FLOWCTL: Final[int]
BT_MODE_STREAMING: Final[int]
BT_PHY: Final[int]
BT_PHY_BR_1M_1SLOT: Final[int]
BT_PHY_BR_1M_3SLOT: Final[int]
BT_PHY_BR_1M_5SLOT: Final[int]
BT_PHY_EDR_2M_1SLOT: Final[int]
BT_PHY_EDR_2M_3SLOT: Final[int]
BT_PHY_EDR_2M_5SLOT: Final[int]
BT_PHY_EDR_3M_1SLOT: Final[int]
BT_PHY_EDR_3M_3SLOT: Final[int]
BT_PHY_EDR_3M_5SLOT: Final[int]
BT_PHY_LE_1M_RX: Final[int]
BT_PHY_LE_1M_TX: Final[int]
BT_PHY_LE_2M_RX: Final[int]
BT_PHY_LE_2M_TX: Final[int]
BT_PHY_LE_CODED_RX: Final[int]
BT_PHY_LE_CODED_TX: Final[int]
BT_PKT_STATUS: Final[int]
BT_POWER: Final[int]
BT_POWER_FORCE_ACTIVE_OFF: Final[int]
BT_POWER_FORCE_ACTIVE_ON: Final[int]
BT_RCVMTU: Final[int]
BT_SECURITY: Final[int]
BT_SECURITY_FIPS: Final[int]
BT_SECURITY_HIGH: Final[int]
BT_SECURITY_LOW: Final[int]
BT_SECURITY_MEDIUM: Final[int]
BT_SECURITY_SDP: Final[int]
BT_SNDMTU: Final[int]
BT_VOICE: Final[int]
BT_VOICE_CVSD_16BIT: Final[int]
BT_VOICE_TRANSPARENT: Final[int]
BT_VOICE_TRANSPARENT_16BIT: Final[int]
HCI_CHANNEL_CONTROL: Final[int]
HCI_CHANNEL_LOGGING: Final[int]
HCI_CHANNEL_MONITOR: Final[int]
HCI_CHANNEL_RAW: Final[int]
HCI_CHANNEL_USER: Final[int]
HCI_DEV_NONE: Final[int]
L2CAP_LM: Final[int]
L2CAP_LM_AUTH: Final[int]
L2CAP_LM_ENCRYPT: Final[int]
L2CAP_LM_MASTER: Final[int]
L2CAP_LM_RELIABLE: Final[int]
L2CAP_LM_SECURE: Final[int]
L2CAP_LM_TRUSTED: Final[int]
SOL_BLUETOOTH: Final[int]
SOL_L2CAP: Final[int]
SOL_RFCOMM: Final[int]
SOL_SCO: Final[int]

# --------------------
# Many constants of these forms, documented in the Unix documentation on
Expand Down Expand Up @@ -76,6 +144,11 @@ if sys.platform != "linux":
SO_USELOOPBACK: Final[int]
if sys.platform == "win32":
SO_EXCLUSIVEADDRUSE: Final[int]
SO_BTH_ENCRYPT: Final[int]
SO_BTH_MTU: Final[int]
SO_BTH_MTU_MAX: Final[int]
SO_BTH_MTU_MIN: Final[int]
SOL_RFCOMM: Final[int]
if sys.platform != "win32":
SO_REUSEPORT: Final[int]
if sys.platform != "darwin" or sys.version_info >= (3, 13):
Expand Down
Loading