diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-08-23 10:10:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-23 10:10:49 (GMT) |
commit | b8058b3da542101f4a227ef2d6a263a5d73d7973 (patch) | |
tree | c3a76710fe11a19944cfe844405572ec6bbd2a07 /Lib | |
parent | d31ae21e5d0e7ec7cd2416176e36b3c135469b0f (diff) | |
download | cpython-b8058b3da542101f4a227ef2d6a263a5d73d7973.zip cpython-b8058b3da542101f4a227ef2d6a263a5d73d7973.tar.gz cpython-b8058b3da542101f4a227ef2d6a263a5d73d7973.tar.bz2 |
[3.9] gh-108342: Break ref cycle in SSLSocket._create() exc (GH-108344) (#108351)
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
@@ -1049,7 +1049,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 |