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 @@ -1867,7 +1867,11 @@ def wrap_conn(self):
1867
1867
# XXX Various errors can have happened here, for example
1868
1868
# a mismatching protocol version, an invalid certificate,
1869
1869
# or a low-level bug. This should be made more discriminating.
1870
- self .server .conn_errors .append (e )
1870
+ #
1871
+ # bpo-31323: Store the exception as string to prevent
1872
+ # a reference leak: server -> conn_errors -> exception
1873
+ # -> traceback -> self (ConnectionHandler) -> server
1874
+ self .server .conn_errors .append (str (e ))
1871
1875
if self .server .chatty :
1872
1876
handle_error ("\n server: bad connection attempt from " + repr (self .addr ) + ":\n " )
1873
1877
self .running = False
@@ -3081,7 +3085,7 @@ def test_default_ciphers(self):
3081
3085
with context .wrap_socket (socket .socket ()) as s :
3082
3086
with self .assertRaises (OSError ):
3083
3087
s .connect ((HOST , server .port ))
3084
- self .assertIn ("no shared cipher" , str ( server .conn_errors [0 ]) )
3088
+ self .assertIn ("no shared cipher" , server .conn_errors [0 ])
3085
3089
3086
3090
def test_version_basic (self ):
3087
3091
"""
You can’t perform that action at this time.
0 commit comments