File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1889,7 +1889,11 @@ def wrap_conn(self):
18891889 # XXX Various errors can have happened here, for example
18901890 # a mismatching protocol version, an invalid certificate,
18911891 # or a low-level bug. This should be made more discriminating.
1892- self .server .conn_errors .append (e )
1892+ #
1893+ # bpo-31323: Store the exception as string to prevent
1894+ # a reference leak: server -> conn_errors -> exception
1895+ # -> traceback -> self (ConnectionHandler) -> server
1896+ self .server .conn_errors .append (str (e ))
18931897 if self .server .chatty :
18941898 handle_error ("\n server: bad connection attempt from " + repr (self .addr ) + ":\n " )
18951899 self .running = False
@@ -3097,7 +3101,7 @@ def test_default_ciphers(self):
30973101 with context .wrap_socket (socket .socket ()) as s :
30983102 with self .assertRaises (OSError ):
30993103 s .connect ((HOST , server .port ))
3100- self .assertIn ("no shared cipher" , str ( server .conn_errors [0 ]) )
3104+ self .assertIn ("no shared cipher" , server .conn_errors [0 ])
31013105
31023106 def test_version_basic (self ):
31033107 """
You can’t perform that action at this time.
0 commit comments