Skip to content

Commit 1dae745

Browse files
authored
bpo-30199: test_ssl closes all asyncore channels (python#1381)
AsyncoreEchoServer of test_ssl now calls asyncore.close_all(ignore_all=True) to ensure that asyncore.socket_map is cleared once the test completes, even if ConnectionHandler was not correctly unregistered. Fix the following warning: Warning -- asyncore.socket_map was modified by test_ssl Before: {} After: {6: <test.test_ssl.AsyncoreEchoServer.EchoServer.ConnectionHandler>}
1 parent 92fd6c9 commit 1dae745

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Lib/test/test_ssl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2064,7 +2064,7 @@ class AsyncoreEchoServer(threading.Thread):
20642064

20652065
class EchoServer (asyncore.dispatcher):
20662066

2067-
class ConnectionHandler (asyncore.dispatcher_with_send):
2067+
class ConnectionHandler(asyncore.dispatcher_with_send):
20682068

20692069
def __init__(self, conn, certfile):
20702070
self.socket = test_wrap_socket(conn, server_side=True,
@@ -2155,6 +2155,8 @@ def __exit__(self, *args):
21552155
self.join()
21562156
if support.verbose:
21572157
sys.stdout.write(" cleanup: successfully joined.\n")
2158+
# make sure that ConnectionHandler is removed from socket_map
2159+
asyncore.close_all(ignore_all=True)
21582160

21592161
def start (self, flag=None):
21602162
self.flag = flag

0 commit comments

Comments
 (0)