diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-08-23 10:09:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-23 10:09:55 (GMT) |
commit | 61dbf46ae3df9d772bfd91b89ab61baeff97a12d (patch) | |
tree | 78e652c7a6b9d9f53908a8c663d82235a005bd66 /Lib | |
parent | 314c98d293765fb6b930c840e6f6ba80f201b3f7 (diff) | |
download | cpython-61dbf46ae3df9d772bfd91b89ab61baeff97a12d.zip cpython-61dbf46ae3df9d772bfd91b89ab61baeff97a12d.tar.gz cpython-61dbf46ae3df9d772bfd91b89ab61baeff97a12d.tar.bz2 |
[3.12] gh-108342: Break ref cycle in SSLSocket._create() exc (GH-108344) (#108348)
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')
-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 |