Skip to content

Commit 4b682d4

Browse files
committed
restore bluetooth socket constants on Linux
fixes #15207
1 parent d1d5fe5 commit 4b682d4

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

stdlib/@tests/stubtest_allowlists/linux.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ fcntl.I_[A-Z0-9_]+ # Platform differences that cannot be captured by the type s
2727
multiprocessing.popen_spawn_win32 # exists on Linux but fails to import
2828
select.poll # Actually a function; we have a class so it can be used as a type
2929

30+
# Bluetooth constants which aren't on the GitHub Actions runners, see #15207
31+
_?socket.AF_BLUETOOTH
32+
_?socket.BDADDR_ANY
33+
_?socket.BTPROTO_HCI
34+
_?socket.BTPROTO_L2CAP
35+
_?socket.BTPROTO_RFCOMM
36+
_?socket.BTPROTO_SCO
37+
3038
# These seem like they should be available on Linux, but they're not
3139
# on GitHub Actions runners for some reason.
3240
_?socket.IPX_TYPE

stdlib/_socket.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ if sys.platform != "linux":
587587

588588
has_ipv6: bool
589589

590-
if sys.platform != "darwin" and sys.platform != "linux":
590+
if sys.platform != "darwin":
591591
BDADDR_ANY: Final = "00:00:00:00:00:00"
592592
BDADDR_LOCAL: Final = "00:00:00:FF:FF:FF"
593593

@@ -660,16 +660,16 @@ if sys.platform == "darwin":
660660
PF_SYSTEM: Final[int]
661661
SYSPROTO_CONTROL: Final[int]
662662

663-
if sys.platform != "darwin" and sys.platform != "linux":
663+
if sys.platform != "darwin":
664664
AF_BLUETOOTH: Final[int]
665665

666-
if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
666+
if sys.platform != "win32" and sys.platform != "darwin":
667667
# Linux and some BSD support is explicit in the docs
668668
# Windows and macOS do not support in practice
669669
BTPROTO_HCI: Final[int]
670670
BTPROTO_L2CAP: Final[int]
671671
BTPROTO_SCO: Final[int] # not in FreeBSD
672-
if sys.platform != "darwin" and sys.platform != "linux":
672+
if sys.platform != "darwin":
673673
BTPROTO_RFCOMM: Final[int]
674674

675675
if sys.platform == "linux":

stdlib/socket.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ if sys.platform != "win32":
519519

520520
__all__ += ["SO_BINDTODEVICE"]
521521

522-
if sys.platform != "darwin" and sys.platform != "linux":
522+
if sys.platform != "darwin":
523523
from _socket import BDADDR_ANY as BDADDR_ANY, BDADDR_LOCAL as BDADDR_LOCAL, BTPROTO_RFCOMM as BTPROTO_RFCOMM
524524

525525
__all__ += ["BDADDR_ANY", "BDADDR_LOCAL", "BTPROTO_RFCOMM"]
@@ -966,10 +966,10 @@ if sys.platform != "win32":
966966

967967
if sys.platform != "linux":
968968
__all__ += ["AF_LINK"]
969-
if sys.platform != "darwin" and sys.platform != "linux":
969+
if sys.platform != "darwin":
970970
__all__ += ["AF_BLUETOOTH"]
971971

972-
if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
972+
if sys.platform != "win32" and sys.platform != "darwin":
973973
from _socket import BTPROTO_HCI as BTPROTO_HCI, BTPROTO_L2CAP as BTPROTO_L2CAP, BTPROTO_SCO as BTPROTO_SCO
974974

975975
__all__ += ["BTPROTO_HCI", "BTPROTO_L2CAP", "BTPROTO_SCO"]
@@ -1131,7 +1131,7 @@ class AddressFamily(IntEnum):
11311131
AF_QIPCRTR = 42
11321132
if sys.platform != "linux":
11331133
AF_LINK = 33
1134-
if sys.platform != "darwin" and sys.platform != "linux":
1134+
if sys.platform != "darwin":
11351135
AF_BLUETOOTH = 32
11361136
if sys.platform == "win32" and sys.version_info >= (3, 12):
11371137
AF_HYPERV = 34
@@ -1186,7 +1186,7 @@ if sys.platform == "linux":
11861186

11871187
if sys.platform != "linux":
11881188
AF_LINK: Final = AddressFamily.AF_LINK
1189-
if sys.platform != "darwin" and sys.platform != "linux":
1189+
if sys.platform != "darwin":
11901190
AF_BLUETOOTH: Final = AddressFamily.AF_BLUETOOTH
11911191
if sys.platform == "win32" and sys.version_info >= (3, 12):
11921192
AF_HYPERV: Final = AddressFamily.AF_HYPERV

0 commit comments

Comments
 (0)