From 7d384a23d09536dd1b4367648389916272f280c1 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 23 Aug 2023 04:38:52 +0200 Subject: [PATCH 1/2] gh-108342: Break ref cycle in SSLSocket._create() exc Break explicitly 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. --- Lib/ssl.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/ssl.py b/Lib/ssl.py index ff363c75e7dfd8..1fd1c834af3108 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -1021,7 +1021,11 @@ def _create(cls, sock, server_side=False, do_handshake_on_connect=True, self.close() except OSError: pass - raise notconn_pre_handshake_data_error + try: + raise notconn_pre_handshake_data_error + finally: + # Break explicitly reference cycle + notconn_pre_handshake_data_error = None else: connected = True From fc88854f100458fe22392329d973ecca3119c6de Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Tue, 22 Aug 2023 21:47:03 -0700 Subject: [PATCH 2/2] reword the comment. --- Lib/ssl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/ssl.py b/Lib/ssl.py index 1fd1c834af3108..c4c5a4ca894ee5 100644 --- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -1024,7 +1024,7 @@ def _create(cls, sock, server_side=False, do_handshake_on_connect=True, try: raise notconn_pre_handshake_data_error finally: - # Break explicitly reference cycle + # Explicitly break the reference cycle. notconn_pre_handshake_data_error = None else: connected = True pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy