[3.12] gh-109534: fix reference leak when SSL handshake fails (GH-114074) (#114829)

gh-109534: fix reference leak when SSL handshake fails (GH-114074)
(cherry picked from commit 80aa7b3688)

Co-authored-by: Jamie Phan <jamie@ordinarylab.dev>
This commit is contained in:
Miss Islington (bot) 2024-02-01 02:00:09 +01:00 committed by GitHub
parent 21b68a1198
commit 0ee6fbaab6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 0 deletions

View file

@ -235,6 +235,10 @@ class BaseSelectorEventLoop(base_events.BaseEventLoop):
await waiter
except BaseException:
transport.close()
# gh-109534: When an exception is raised by the SSLProtocol object the
# exception set in this future can keep the protocol object alive and
# cause a reference cycle.
waiter = None
raise
# It's now up to the protocol to handle the connection.