[3.9] gh-108342: Break ref cycle in SSLSocket._create() exc (GH-108344) (#108351)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 23 Aug 2023 10:10:49 +0000 (03:10 -0700)
committerSean Whitton <spwhitton@spwhitton.name>
Thu, 20 Mar 2025 02:07:39 +0000 (10:07 +0800)
commit2e9a596fe056c682f3b1701ba6894fa8cb05dcf9
tree6583cf2fdc3c02dd4e32fcec8e51d44de2c936c8
parent5edb355a81eebc5817bce24f247952d63b1ed37d
[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>
Gbp-Pq: Name 0017-3.9-gh-108342-Break-ref-cycle-in-SSLSocket._create-e.patch
Lib/ssl.py