Skip to content

Commit

Permalink
[3.11] GH-98539: fix ref cycle in _SSLProtocolTransport after close (
Browse files Browse the repository at this point in the history
…GH-98540) (#98551)

GH-98539: fix ref cycle in `_SSLProtocolTransport` after close  (GH-98540)
(cherry picked from commit 62bf5d8)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
  • Loading branch information
miss-islington and kumaraditya303 committed Oct 24, 2022
1 parent c4ad3fc commit bd8b32b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Lib/asyncio/sslproto.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,11 @@ def close(self):
protocol's connection_lost() method will (eventually) called
with None as its argument.
"""
self._closed = True
self._ssl_protocol._start_shutdown()
if not self._closed:
self._closed = True
self._ssl_protocol._start_shutdown()
else:
self._ssl_protocol = None

def __del__(self, _warnings=warnings):
if not self._closed:
Expand Down

0 comments on commit bd8b32b

Please sign in to comment.