From ad9f817eeb2d2d36834e7bad2264ad0c0de1d1c4 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Wed, 27 Apr 2022 13:47:17 +0100 Subject: gh-91498: socket: Add TCP_CONNECTION_INFO on macOS (#69256) Fixes GH-91498 --- Doc/library/socket.rst | 4 ++++ Misc/NEWS.d/next/Library/2022-04-10-08-39-44.bpo-91498.8oII92.rst | 1 + Modules/socketmodule.c | 3 +++ 3 files changed, 8 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2022-04-10-08-39-44.bpo-91498.8oII92.rst diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index cff5a32..3b1912c 100755 --- a/Doc/library/socket.rst +++ b/Doc/library/socket.rst @@ -388,6 +388,10 @@ Constants Added ``TCP_KEEPALIVE``. On MacOS this constant can be used in the same way that ``TCP_KEEPIDLE`` is used on Linux. + .. versionchanged:: 3.11 + Added ``TCP_CONNECTION_INFO``. On MacOS this constant can be used in the + same way that ``TCP_INFO`` is used on Linux and BSD. + .. data:: AF_CAN PF_CAN SOL_CAN_* diff --git a/Misc/NEWS.d/next/Library/2022-04-10-08-39-44.bpo-91498.8oII92.rst b/Misc/NEWS.d/next/Library/2022-04-10-08-39-44.bpo-91498.8oII92.rst new file mode 100644 index 0000000..df3b81f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-04-10-08-39-44.bpo-91498.8oII92.rst @@ -0,0 +1 @@ +Add the ``TCP_CONNECTION_INFO`` option (available on macOS) to :mod:`socket`. diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index c7bc10b..9ecabaf 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -8213,6 +8213,9 @@ PyInit__socket(void) #ifdef TCP_INFO PyModule_AddIntMacro(m, TCP_INFO); #endif +#ifdef TCP_CONNECTION_INFO + PyModule_AddIntMacro(m, TCP_CONNECTION_INFO); +#endif #ifdef TCP_QUICKACK PyModule_AddIntMacro(m, TCP_QUICKACK); #endif -- cgit v0.12