diff options
author | Victor Stinner <vstinner@python.org> | 2023-08-23 05:26:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-23 05:26:01 (GMT) |
commit | 64f99350351bc46e016b2286f36ba7cd669b79e3 (patch) | |
tree | 14a9d35a1bc9ae688fce5d96adfebb174185d62c /Lib/ssl.py | |
parent | 9173b2bbe13aeccc075b571da05c653a2a91de1b (diff) | |
download | cpython-64f99350351bc46e016b2286f36ba7cd669b79e3.zip cpython-64f99350351bc46e016b2286f36ba7cd669b79e3.tar.gz cpython-64f99350351bc46e016b2286f36ba7cd669b79e3.tar.bz2 |
gh-108342: Break ref cycle in SSLSocket._create() exc (#108344)
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 #108310.
Diffstat (limited to 'Lib/ssl.py')
-rw-r--r-- | Lib/ssl.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -1021,7 +1021,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 |