From: David CARLIER Date: Wed, 27 Apr 2022 12:47:17 +0000 (+0100) Subject: gh-91498: socket: Add TCP_CONNECTION_INFO on macOS (#69256) X-Git-Tag: v3.11.0b1~203 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ad9f817eeb2d2d36834e7bad2264ad0c0de1d1c4;p=thirdparty%2FPython%2Fcpython.git gh-91498: socket: Add TCP_CONNECTION_INFO on macOS (#69256) Fixes GH-91498 --- diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst index cff5a32afb46..3b1912cff88a 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 000000000000..df3b81fd1168 --- /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 c7bc10b5dbbb..9ecabaf97307 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