summaryrefslogtreecommitdiffstats
path: root/Lib/ssl.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-08-23 10:10:04 (GMT)
committerGitHub <noreply@github.com>2023-08-23 10:10:04 (GMT)
commit93714b7db795b14b26adffde30753cfda0ca4867 (patch)
tree6b147154360cb85bb7f47f5e97e92193900b8b21 /Lib/ssl.py
parent07c727e92a72ea8a9e7d9705b4afc261c32fa1ce (diff)
downloadcpython-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.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/ssl.py b/Lib/ssl.py
index ced87d4..48d229f 100644
--- a/Lib/ssl.py
+++ b/Lib/ssl.py
@@ -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