[Python-checkins] bpo-46696: Add socket.SO_INCOMING_CPU constant (#31237)

JelleZijlstra webhook-mailer at python.org
Tue May 3 13:33:26 EDT 2022


https://github.com/python/cpython/commit/d5dfcd4489e25c1b6e985fb6b8a700c8a49c68df
commit: d5dfcd4489e25c1b6e985fb6b8a700c8a49c68df
branch: main
author: David CARLIER <devnexen at gmail.com>
committer: JelleZijlstra <jelle.zijlstra at gmail.com>
date: 2022-05-03T11:33:11-06:00
summary:

bpo-46696: Add socket.SO_INCOMING_CPU constant (#31237)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra at gmail.com>

files:
A Misc/NEWS.d/next/Library/2022-02-09-21-40-02.bpo-46696.nPXRno.rst
M Doc/library/socket.rst
M Modules/socketmodule.c

diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 3b1912cff88a4..ee1aee5278b3b 100755
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -575,6 +575,15 @@ Constants
 
    .. availability:: FreeBSD.
 
+.. data:: SO_INCOMING_CPU
+
+   Constant to optimize CPU locality, to be used in conjunction with
+   :data:`SO_REUSEPORT`.
+
+  .. versionadded:: 3.11
+
+  .. availability:: Linux >= 3.9
+
 Functions
 ^^^^^^^^^
 
diff --git a/Misc/NEWS.d/next/Library/2022-02-09-21-40-02.bpo-46696.nPXRno.rst b/Misc/NEWS.d/next/Library/2022-02-09-21-40-02.bpo-46696.nPXRno.rst
new file mode 100644
index 0000000000000..04c41887afd6e
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-02-09-21-40-02.bpo-46696.nPXRno.rst
@@ -0,0 +1 @@
+Add ``SO_INCOMING_CPU`` constant to :mod:`socket`.
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 9ecabaf973074..c650b25c09509 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -7505,6 +7505,9 @@ PyInit__socket(void)
 #ifdef SO_EXCLUSIVEADDRUSE
     PyModule_AddIntMacro(m, SO_EXCLUSIVEADDRUSE);
 #endif
+#ifdef SO_INCOMING_CPU
+    PyModule_AddIntMacro(m, SO_INCOMING_CPU);
+#endif
 
 #ifdef  SO_KEEPALIVE
     PyModule_AddIntMacro(m, SO_KEEPALIVE);



More information about the Python-checkins mailing list