]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] GH-98539: fix ref cycle in `_SSLProtocolTransport` after close (GH-98540...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 24 Oct 2022 16:26:32 +0000 (09:26 -0700)
committerGitHub <noreply@github.com>
Mon, 24 Oct 2022 16:26:32 +0000 (09:26 -0700)
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>
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: