GH-98539: fix ref cycle in `_SSLProtocolTransport` after close (GH-98540)
(cherry picked from commit
62bf5d8d0a36112619436a813ceefb7e4af52c24)
Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
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: