]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
GH-98539: fix ref cycle in `_SSLProtocolTransport` after close (#98540)
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Sat, 22 Oct 2022 16:11:27 +0000 (21:41 +0530)
committerGitHub <noreply@github.com>
Sat, 22 Oct 2022 16:11:27 +0000 (09:11 -0700)
Lib/asyncio/sslproto.py

index de00953cc1d0f7f49fea42a2eb0fc4fde2d2aa99..5cb5cd35883f07dbbd116cedbb62f0a7c20a7255 100644 (file)
@@ -107,8 +107,11 @@ class _SSLProtocolTransport(transports._FlowControlMixin,
         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: