https://github.com/python/cpython/commit/43bf8b30f918cb72ac9b992d55cdebf9c4299288
commit: 43bf8b30f918cb72ac9b992d55cdebf9c4299288
branch: 3.14
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: vsajip <vinay_sa...@yahoo.co.uk>
date: 2025-06-16T08:05:26+01:00
summary:

[3.14] gh-127319: Disable port reuse on HTTP, XMLRPC, and logging TCP servers 
(GH-135405) (GH-135538)

(cherry picked from commit 2bd3895fcabb2dfdae5c0c72e60483e3d3267f0f)

files:
A 
Misc/NEWS.d/next/Core_and_Builtins/2025-06-11-15-08-10.gh-issue-127319.OVGFSZ.rst
M Lib/http/server.py
M Lib/logging/config.py
M Lib/test/test_logging.py
M Lib/xmlrpc/server.py

diff --git a/Lib/http/server.py b/Lib/http/server.py
index dda32644a28f90..10d18a9a753929 100644
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -137,7 +137,7 @@
 class HTTPServer(socketserver.TCPServer):
 
     allow_reuse_address = True    # Seems to make sense in testing environment
-    allow_reuse_port = True
+    allow_reuse_port = False
 
     def server_bind(self):
         """Override server_bind to store the server name."""
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index c994349fd6eee5..3d9aa00fa52d11 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -1018,7 +1018,7 @@ class ConfigSocketReceiver(ThreadingTCPServer):
         """
 
         allow_reuse_address = True
-        allow_reuse_port = True
+        allow_reuse_port = False
 
         def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT,
                      handler=None, ready=None, verify=None):
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 1e5adcc8db13f6..98ed154d8c652a 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -1036,7 +1036,7 @@ class TestTCPServer(ControlMixin, ThreadingTCPServer):
     """
 
     allow_reuse_address = True
-    allow_reuse_port = True
+    allow_reuse_port = False
 
     def __init__(self, addr, handler, poll_interval=0.5,
                  bind_and_activate=True):
diff --git a/Lib/xmlrpc/server.py b/Lib/xmlrpc/server.py
index 90a356fbb8eae4..8130c739af2fe8 100644
--- a/Lib/xmlrpc/server.py
+++ b/Lib/xmlrpc/server.py
@@ -578,7 +578,7 @@ class SimpleXMLRPCServer(socketserver.TCPServer,
     """
 
     allow_reuse_address = True
-    allow_reuse_port = True
+    allow_reuse_port = False
 
     # Warning: this is for debugging purposes only! Never set this to True in
     # production code, as will be sending out sensitive information (exception
diff --git 
a/Misc/NEWS.d/next/Core_and_Builtins/2025-06-11-15-08-10.gh-issue-127319.OVGFSZ.rst
 
b/Misc/NEWS.d/next/Core_and_Builtins/2025-06-11-15-08-10.gh-issue-127319.OVGFSZ.rst
new file mode 100644
index 00000000000000..d90153c96841df
--- /dev/null
+++ 
b/Misc/NEWS.d/next/Core_and_Builtins/2025-06-11-15-08-10.gh-issue-127319.OVGFSZ.rst
@@ -0,0 +1,3 @@
+Set the ``allow_reuse_port`` class variable to ``False`` on the XMLRPC,
+logging, and HTTP servers. This matches the behavior in prior Python
+releases, which is to not allow port reuse.

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to