From 89a54c73746417bae003a9985668fa665040d5d9 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 2 May 2017 16:48:36 +0200 Subject: [PATCH] bpo-30199: test_ssl closes all asyncore channels (#1381) (#1389) 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: } (cherry picked from commit 1dae7450c68bad498e57800387b24cb103c461fa) --- Lib/test/test_ssl.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 551558304f..ffb7314f57 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -2034,7 +2034,7 @@ else: class EchoServer (asyncore.dispatcher): - class ConnectionHandler (asyncore.dispatcher_with_send): + class ConnectionHandler(asyncore.dispatcher_with_send): def __init__(self, conn, certfile): self.socket = ssl.wrap_socket(conn, server_side=True, @@ -2125,6 +2125,8 @@ else: self.join() if support.verbose: sys.stdout.write(" cleanup: successfully joined.\n") + # make sure that ConnectionHandler is removed from socket_map + asyncore.close_all(ignore_all=True) def start (self, flag=None): self.flag = flag -- 2.50.0