-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Add Bluetooth constants for python 3.14 #15330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 12 commits
61b540f
f460d10
541eb42
8875184
83ca700
d8ee6b5
717f7cb
74c8f48
3efa725
b9f25b7
78ddaf3
096518f
e5a8806
ac8ecb8
f2eb6ac
16415a6
a987b39
d73e6e7
a7e5293
b1a62e3
457e7fe
e0056ab
db48b40
e8bff12
7827112
4cf8971
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -35,7 +35,72 @@ select.poll # Actually a function; we have a class so it can be used as a type | |||||
| (_?socket\.BTPROTO_L2CAP)? | ||||||
| (_?socket\.BTPROTO_RFCOMM)? | ||||||
| (_?socket\.BTPROTO_SCO)? | ||||||
|
|
||||||
| _socket.BDADDR_BREDR | ||||||
|
||||||
| _socket.BDADDR_BREDR | |
| (_?socket.BDADDR_BREDR)? |
This and all the others being added need to follow the existing pattern.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| _socket.SOL_L2CAP | |
| _socket.SOL_SCO |
These are duplicate. Please check the list for other duplicates. Sorting the list in alphabetical order should make it easy to catch these.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,9 @@ _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 | ||
| ) # int is included because of device_id not packed in a tuple is now accepted for BTPROTO_HCI | ||
|
||
| _RetAddress: TypeAlias = Any | ||
|
|
||
| # ===== Constants ===== | ||
|
|
@@ -76,6 +78,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): | ||
|
|
@@ -240,11 +247,6 @@ if sys.version_info >= (3, 14): | |
| SO_ORIGINAL_DST: Final[int] | ||
|
|
||
| if sys.platform == "win32": | ||
| SOL_RFCOMM: Final[int] | ||
| SO_BTH_ENCRYPT: Final[int] | ||
| SO_BTH_MTU: Final[int] | ||
| SO_BTH_MTU_MAX: Final[int] | ||
| SO_BTH_MTU_MIN: Final[int] | ||
| TCP_QUICKACK: Final[int] | ||
|
|
||
| if sys.platform == "linux": | ||
|
|
@@ -579,7 +581,47 @@ if sys.platform == "linux": | |
| SO_VM_SOCKETS_BUFFER_SIZE: Final = 0 | ||
| SO_VM_SOCKETS_BUFFER_MIN_SIZE: Final = 1 | ||
| VM_SOCKETS_INVALID_VERSION: Final = 0xFFFFFFFF # undocumented | ||
|
|
||
| # Bluetooth constants new in 3.14 | ||
| if sys.version_info >= (3, 14): | ||
| BDADDR_BREDR: int | ||
| BDADDR_LE_PUBLIC: int | ||
| BDADDR_LE_RANDOM: int | ||
| BT_CHANNEL_POLICY: int | ||
| BT_CHANNEL_POLICY_BREDR_ONLY: int | ||
| BT_CHANNEL_POLICY_BREDR_PREFERRED: int | ||
| BT_CODEC: int | ||
| BT_DEFER_SETUP: int | ||
| BT_FLUSHABLE: int | ||
| BT_FLUSHABLE_OFF: int | ||
| BT_FLUSHABLE_ON: int | ||
| BT_ISO_QOS: int | ||
| BT_MODE: int | ||
| BT_MODE_BASIC: int | ||
| BT_MODE_ERTM: int | ||
| BT_MODE_STREAM: int | ||
| BT_PHY: int | ||
| BT_PHY_BR_1M_1SLOT: int | ||
| BT_PHY_EDR_2M_1SLOT: int | ||
| BT_PHY_EDR_2M_3SLOT: int | ||
| BT_PHY_EDR_2M_5SLOT: int | ||
| BT_PHY_EDR_3M_1SLOT: int | ||
| BT_PHY_EDR_3M_3SLOT: int | ||
| BT_PHY_EDR_3M_5SLOT: int | ||
| BT_PHY_LE_1M_RX: int | ||
| BT_PHY_LE_1M_TX: int | ||
| BT_PHY_LE_2M_RX: int | ||
| BT_PHY_LE_2M_TX: int | ||
| BT_PHY_LE_CODED_RX: int | ||
| BT_PHY_LE_CODED_TX: int | ||
| BT_PKT_STATUS: int | ||
| BT_POWER: int | ||
| BT_POWER_FORCE_ACTIVE_OFF: int | ||
| BT_POWER_FORCE_ACTIVE_ON: int | ||
| BT_RCVMTU: int | ||
| BT_SCM_PKT_STATUS: int | ||
| BT_SNDMTU: int | ||
| BT_VOICE: int | ||
| BT_VOICE_FOR_MSBC: int | ||
| # Documented as only available on BSD, macOS, but empirically sometimes | ||
| # available on Windows | ||
| if sys.platform != "linux": | ||
|
|
@@ -630,9 +672,76 @@ if sys.version_info >= (3, 12): | |
| ETHERTYPE_IP: Final[int] | ||
| ETHERTYPE_IPV6: Final[int] | ||
| ETHERTYPE_VLAN: Final[int] | ||
| # -------------------- | ||
| # Semi-documented constants | ||
| BDADDR_BREDR: Final[int] | ||
| 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] | ||
|
|
||
| # -------------------- | ||
| # Semi-documented constants | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't move this comment. Instead the new Bluetooth constants should be added somewhere below here. |
||
| # These are alluded to under the "Socket families" section in the docs | ||
| # https://docs.python.org/3/library/socket.html#socket-families | ||
| # -------------------- | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything existing in this file for
_socket.*, so I don't think we should be adding anything here.