[socket/_socket] Restore bluetooth socket constants on Linux (#15209)

This commit is contained in:
Stephen Morton
2026-01-19 06:56:32 -08:00
committed by GitHub
parent 2bcf7bb270
commit cc24a838fc
3 changed files with 19 additions and 8 deletions
+6 -4
View File
@@ -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):
@@ -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":
@@ -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
@@ -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