Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
9 changes: 9 additions & 0 deletions stdlib/@tests/stubtest_allowlists/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ fcntl.I_[A-Z0-9_]+ # Platform differences that cannot be captured by the type s
multiprocessing.popen_spawn_win32 # exists on Linux but fails to import
select.poll # Actually a function; we have a class so it can be used as a type

# Bluetooth constants which aren't on the GitHub Actions runners, see #15207
_?socket.AF_BLUETOOTH
_?socket.BDADDR_ANY
_?socket.BDADDR_LOCAL
_?socket.BTPROTO_HCI
_?socket.BTPROTO_L2CAP
_?socket.BTPROTO_RFCOMM
_?socket.BTPROTO_SCO

# These seem like they should be available on Linux, but they're not
# on GitHub Actions runners for some reason.
_?socket.IPX_TYPE
Expand Down
8 changes: 4 additions & 4 deletions stdlib/_socket.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ if sys.platform != "linux":

has_ipv6: bool

if sys.platform != "darwin" and sys.platform != "linux":
if sys.platform != "darwin":
BDADDR_ANY: Final = "00:00:00:00:00:00"
BDADDR_LOCAL: Final = "00:00:00:FF:FF:FF"

Expand Down Expand Up @@ -660,16 +660,16 @@ if sys.platform == "darwin":
PF_SYSTEM: Final[int]
SYSPROTO_CONTROL: Final[int]

if sys.platform != "darwin" and sys.platform != "linux":
if sys.platform != "darwin":
AF_BLUETOOTH: Final[int]

if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
if sys.platform != "win32" and sys.platform != "darwin":
# Linux and some BSD support is explicit in the docs
# Windows and macOS do not support in practice
BTPROTO_HCI: Final[int]
BTPROTO_L2CAP: Final[int]
BTPROTO_SCO: Final[int] # not in FreeBSD
if sys.platform != "darwin" and sys.platform != "linux":
if sys.platform != "darwin":
BTPROTO_RFCOMM: Final[int]

if sys.platform == "linux":
Expand Down
10 changes: 6 additions & 4 deletions stdlib/socket.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,10 @@ if sys.platform != "win32":

__all__ += ["SO_BINDTODEVICE"]

if sys.platform != "darwin" and sys.platform != "linux":
if sys.platform != "darwin":
from _socket import BDADDR_ANY as BDADDR_ANY, BDADDR_LOCAL as BDADDR_LOCAL, BTPROTO_RFCOMM as BTPROTO_RFCOMM

if sys.platform != "darwin" and sys.platform != "linux":
__all__ += ["BDADDR_ANY", "BDADDR_LOCAL", "BTPROTO_RFCOMM"]

if sys.platform == "darwin" and sys.version_info >= (3, 10):
Expand Down Expand Up @@ -969,9 +970,10 @@ if sys.platform != "linux":
if sys.platform != "darwin" and sys.platform != "linux":
__all__ += ["AF_BLUETOOTH"]

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

if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
__all__ += ["BTPROTO_HCI", "BTPROTO_L2CAP", "BTPROTO_SCO"]

if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux":
Expand Down Expand Up @@ -1131,7 +1133,7 @@ class AddressFamily(IntEnum):
AF_QIPCRTR = 42
if sys.platform != "linux":
AF_LINK = 33
if sys.platform != "darwin" and sys.platform != "linux":
if sys.platform != "darwin":
AF_BLUETOOTH = 32
if sys.platform == "win32" and sys.version_info >= (3, 12):
AF_HYPERV = 34
Expand Down Expand Up @@ -1186,7 +1188,7 @@ if sys.platform == "linux":

if sys.platform != "linux":
AF_LINK: Final = AddressFamily.AF_LINK
if sys.platform != "darwin" and sys.platform != "linux":
if sys.platform != "darwin":
AF_BLUETOOTH: Final = AddressFamily.AF_BLUETOOTH
if sys.platform == "win32" and sys.version_info >= (3, 12):
AF_HYPERV: Final = AddressFamily.AF_HYPERV
Expand Down