mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[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 64f9935035
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
07c727e92a
commit
93714b7db7
1 changed files with 5 additions and 1 deletions
|
@ -1083,7 +1083,11 @@ class SSLSocket(socket):
|
|||
self.close()
|
||||
except OSError:
|
||||
pass
|
||||
raise notconn_pre_handshake_data_error
|
||||
try:
|
||||
raise notconn_pre_handshake_data_error
|
||||
finally:
|
||||
# Explicitly break the reference cycle.
|
||||
notconn_pre_handshake_data_error = None
|
||||
else:
|
||||
connected = True
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue