From 5f92f7b98aa94f8847370f20633d169e52252aa5 Mon Sep 17 00:00:00 2001 From: Guo Ci Date: Thu, 11 Dec 2025 13:21:11 -0500 Subject: [PATCH 1/2] [stdlib][socket] import constants from the `_socket` module Add missing imports. docs: https://docs.python.org/dev/library/socket.html --- stdlib/socket.pyi | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index b10b3560b91f..cb3578ef72e3 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -969,6 +969,33 @@ 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": + from _socket import ( + BTPROTO_HCI as BTPROTO_HCI, + BTPROTO_L2CAP as BTPROTO_L2CAP, + BTPROTO_SCO as BTPROTO_SCO, + ) + + __all__ += ["BTPROTO_HCI", "BTPROTO_L2CAP", "BTPROTO_SCO"] + +if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": + from _socket import ( + HCI_FILTER as HCI_FILTER, + HCI_TIME_STAMP as HCI_TIME_STAMP, + HCI_DATA_DIR as HCI_DATA_DIR, + ) + + __all__ += ["HCI_FILTER", "HCI_TIME_STAMP", "HCI_DATA_DIR"] + +if sys.version_info >= (3, 11) and sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin": + from _socket import ( + SCM_CREDS2 as SCM_CREDS2, + LOCAL_CREDS as LOCAL_CREDS, + LOCAL_CREDS_PERSISTENT as LOCAL_CREDS_PERSISTENT, + ) + + __all__ += ["SCM_CREDS2", "LOCAL_CREDS", "LOCAL_CREDS_PERSISTENT"] + if sys.platform == "win32" and sys.version_info >= (3, 12): __all__ += ["AF_HYPERV"] From 451f0287f117db4e01cae163307e1534a449e776 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 11 Dec 2025 18:23:54 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/socket.pyi | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index cb3578ef72e3..92bf48c3a2d8 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -970,29 +970,17 @@ if sys.platform != "darwin" and sys.platform != "linux": __all__ += ["AF_BLUETOOTH"] if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": - from _socket import ( - BTPROTO_HCI as BTPROTO_HCI, - BTPROTO_L2CAP as BTPROTO_L2CAP, - BTPROTO_SCO as BTPROTO_SCO, - ) + from _socket import BTPROTO_HCI as BTPROTO_HCI, BTPROTO_L2CAP as BTPROTO_L2CAP, BTPROTO_SCO as BTPROTO_SCO __all__ += ["BTPROTO_HCI", "BTPROTO_L2CAP", "BTPROTO_SCO"] if sys.platform != "win32" and sys.platform != "darwin" and sys.platform != "linux": - from _socket import ( - HCI_FILTER as HCI_FILTER, - HCI_TIME_STAMP as HCI_TIME_STAMP, - HCI_DATA_DIR as HCI_DATA_DIR, - ) + from _socket import HCI_DATA_DIR as HCI_DATA_DIR, HCI_FILTER as HCI_FILTER, HCI_TIME_STAMP as HCI_TIME_STAMP __all__ += ["HCI_FILTER", "HCI_TIME_STAMP", "HCI_DATA_DIR"] if sys.version_info >= (3, 11) and sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin": - from _socket import ( - SCM_CREDS2 as SCM_CREDS2, - LOCAL_CREDS as LOCAL_CREDS, - LOCAL_CREDS_PERSISTENT as LOCAL_CREDS_PERSISTENT, - ) + from _socket import LOCAL_CREDS as LOCAL_CREDS, LOCAL_CREDS_PERSISTENT as LOCAL_CREDS_PERSISTENT, SCM_CREDS2 as SCM_CREDS2 __all__ += ["SCM_CREDS2", "LOCAL_CREDS", "LOCAL_CREDS_PERSISTENT"]