10000 [3.11] gh-108342: Break ref cycle in SSLSocket._create() exc (GH-1083… · python/cpython@93714b7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 93714b7

Browse files
[3.11] gh-108342: Break ref cycle in SSLSocket._create() exc (GH-108344) (#108349)
Explicitly break a reference cycle when SSLSocket._create() raises an exception. Clear the variable storing the exception, since the exception traceback contains the variables and so creates a reference cycle. This test leak was introduced by the test added for the fix of GH-108310. (cherry picked from commit 64f9935) Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 07c727e commit 93714b7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Lib/ssl.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,11 @@ def _create(cls, sock, server_side=False, do_handshake_on_connect=True,
10831083
self.close()
10841084
except OSError:
10851085
pass
1086-
raise notconn_pre_handshake_data_error
1086+
try:
1087+
raise notconn_pre_handshake_data_error
1088+
finally:
1089+
# Explicitly break the reference cycle.
1090+
notconn_pre_handshake_data_error = None
10871091
else:
10881092
connected = True
10891093

0 commit comments

Comments
 (0)
0