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):
1889
1889
# XXX Various errors can have happened here, for example
1890
1890
# a mismatching protocol version, an invalid certificate,
1891
1891
# 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 ))
1893
1897
if self .server .chatty :
1894
1898
handle_error ("\n server: bad connection attempt from " + repr (self .addr ) + ":\n " )
1895
1899
self .running = False
@@ -3097,7 +3101,7 @@ def test_default_ciphers(self):
3097
3101
with context .wrap_socket (socket .socket ()) as s :
3098
3102
with self .assertRaises (OSError ):
3099
3103
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 ])
3101
3105
3102
3106
def test_version_basic (self ):
3103
3107
"""
You can’t perform that action at this time.
0 commit comments