From 6bdd2dc36a6bc77bde84778574837442ed94f7d5 Mon Sep 17 00:00:00 2001 From: Idan Kapustian Date: Fri, 14 Jun 2024 10:22:28 +0300 Subject: [PATCH 1/6] Added an override to allow_reuse_port where allow_reuse_address is overriden --- Lib/http/server.py | 1 + Lib/logging/config.py | 1 + Lib/test/test_logging.py | 1 + Lib/xmlrpc/server.py | 1 + 4 files changed, 4 insertions(+) diff --git a/Lib/http/server.py b/Lib/http/server.py index 7d0da5052d2d4d..90e6101b652d73 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -130,6 +130,7 @@ class HTTPServer(socketserver.TCPServer): allow_reuse_address = 1 # Seems to make sense in testing environment + allow_reuse_port = 1 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 9de84e527b18ac..084ae6c75bb3c5 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -985,6 +985,7 @@ class ConfigSocketReceiver(ThreadingTCPServer): """ allow_reuse_address = 1 + allow_reuse_port = 1 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 ef2d4a621be962..a614bfae8a34e4 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -1038,6 +1038,7 @@ class TestTCPServer(ControlMixin, ThreadingTCPServer): """ allow_reuse_address = True + allow_reuse_port = True 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 4dddb1d10e08bd..90a356fbb8eae4 100644 --- a/Lib/xmlrpc/server.py +++ b/Lib/xmlrpc/server.py @@ -578,6 +578,7 @@ class SimpleXMLRPCServer(socketserver.TCPServer, """ allow_reuse_address = True + allow_reuse_port = True # Warning: this is for debugging purposes only! Never set this to True in # production code, as will be sending out sensitive information (exception From 8224b32d72b597c58f35ed688090e9a1d0b81993 Mon Sep 17 00:00:00 2001 From: Idan Kapustian Date: Fri, 14 Jun 2024 10:24:49 +0300 Subject: [PATCH 2/6] Changed old usage of boolean from 1 to True --- Lib/http/server.py | 4 ++-- Lib/logging/config.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/http/server.py b/Lib/http/server.py index 90e6101b652d73..2d010649e56b51 100644 --- a/Lib/http/server.py +++ b/Lib/http/server.py @@ -129,8 +129,8 @@ class HTTPServer(socketserver.TCPServer): - allow_reuse_address = 1 # Seems to make sense in testing environment - allow_reuse_port = 1 + allow_reuse_address = True # Seems to make sense in testing environment + allow_reuse_port = True 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 084ae6c75bb3c5..d2f23e53f35c57 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -984,8 +984,8 @@ class ConfigSocketReceiver(ThreadingTCPServer): A simple TCP socket-based logging config receiver. """ - allow_reuse_address = 1 - allow_reuse_port = 1 + allow_reuse_address = True + allow_reuse_port = True def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT, handler=None, ready=None, verify=None): From 1a6e7ac243409dccc4529aab4473157657f1e8cc Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 14 Jun 2024 07:52:01 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst b/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst new file mode 100644 index 00000000000000..642df3aab2ea87 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst @@ -0,0 +1 @@ +Add an override of `allow_reuse_port` on classes inheriting socketserver.TCPServer where `allow_reuse_address` is also overriden From bfd23d8d55b63bd9f10e759924f3c071b92eb9a2 Mon Sep 17 00:00:00 2001 From: Idan Kapustian <71190257+idankap@users.noreply.github.com> Date: Fri, 14 Jun 2024 10:57:48 +0300 Subject: [PATCH 4/6] Fix linting on NEWS entry --- .../2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst b/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst index 642df3aab2ea87..ca61b509a9ee36 100644 --- a/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst +++ b/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst @@ -1 +1 @@ -Add an override of `allow_reuse_port` on classes inheriting socketserver.TCPServer where `allow_reuse_address` is also overriden +Add an override of ``allow_reuse_port`` on classes inheriting socketserver.TCPServer where ``allow_reuse_address`` is also overriden From b278a0b7c49f4332fbfe696edcffe491eabea0b3 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Fri, 14 Jun 2024 18:23:06 +0100 Subject: [PATCH 5/6] Use correct spelling. --- .../2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst b/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst index ca61b509a9ee36..d673c1f0376694 100644 --- a/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst +++ b/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst @@ -1 +1 @@ -Add an override of ``allow_reuse_port`` on classes inheriting socketserver.TCPServer where ``allow_reuse_address`` is also overriden +Add an override of ``allow_reuse_port`` on classes inheriting socketserver.TCPServer where ``allow_reuse_address`` is also overridden From 2cfc68c8b46f74a893640951a32774ff6ba2a854 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Sat, 15 Jun 2024 19:14:54 +0100 Subject: [PATCH 6/6] Improved NEWS entry, --- .../2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst b/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst index d673c1f0376694..f41c233908362f 100644 --- a/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst +++ b/Misc/NEWS.d/next/Core and Builtins/2024-06-14-07-52-00.gh-issue-120485.yy4K4b.rst @@ -1 +1 @@ -Add an override of ``allow_reuse_port`` on classes inheriting socketserver.TCPServer where ``allow_reuse_address`` is also overridden +Add an override of ``allow_reuse_port`` on classes subclassing ``socketserver.TCPServer`` where ``allow_reuse_address`` is also overridden.