diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-08-23 10:10:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-23 10:10:04 (GMT) |
commit | 93714b7db795b14b26adffde30753cfda0ca4867 (patch) | |
tree | 6b147154360cb85bb7f47f5e97e92193900b8b21 /Lib/ssl.py | |
parent | 07c727e92a72ea8a9e7d9705b4afc261c32fa1ce (diff) | |
download | cpython-93714b7db795b14b26adffde30753cfda0ca4867.zip cpython-93714b7db795b14b26adffde30753cfda0ca4867.tar.gz cpython-93714b7db795b14b26adffde30753cfda0ca4867.tar.bz2 |
[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 64f99350351bc46e016b2286f36ba7cd669b79e3)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib/ssl.py')
-rw-r--r-- | Lib/ssl.py | 6 |
1 files changed, 5 insertions, 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 |