summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid CARLIER <devnexen@gmail.com>2022-04-27 12:47:17 (GMT)
committerGitHub <noreply@github.com>2022-04-27 12:47:17 (GMT)
commitad9f817eeb2d2d36834e7bad2264ad0c0de1d1c4 (patch)
tree3014284a0af709d1eb26ef2782c1128b53910ed5
parentb733708ca32afb5742d921f0b2cad39f4741af50 (diff)
downloadcpython-ad9f817eeb2d2d36834e7bad2264ad0c0de1d1c4.zip
cpython-ad9f817eeb2d2d36834e7bad2264ad0c0de1d1c4.tar.gz
cpython-ad9f817eeb2d2d36834e7bad2264ad0c0de1d1c4.tar.bz2
gh-91498: socket: Add TCP_CONNECTION_INFO on macOS (#69256)
Fixes GH-91498
-rwxr-xr-xDoc/library/socket.rst4
-rw-r--r--Misc/NEWS.d/next/Library/2022-04-10-08-39-44.bpo-91498.8oII92.rst1
-rw-r--r--Modules/socketmodule.c3
3 files changed, 8 insertions, 0 deletions
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