summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/sslproto.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-10-24 16:26:32 (GMT)
committerGitHub <noreply@github.com>2022-10-24 16:26:32 (GMT)
commitbd8b32b519055b5411e1954698e596d728fc848e (patch)
treeee07e661e85b21951557b417083b6caec9411f49 /Lib/asyncio/sslproto.py
parentc4ad3fce6653020cfe16c2512faedc3be80ed09d (diff)
downloadcpython-bd8b32b519055b5411e1954698e596d728fc848e.zip
cpython-bd8b32b519055b5411e1954698e596d728fc848e.tar.gz
cpython-bd8b32b519055b5411e1954698e596d728fc848e.tar.bz2
[3.11] GH-98539: fix ref cycle in `_SSLProtocolTransport` after close (GH-98540) (#98551)
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>
Diffstat (limited to 'Lib/asyncio/sslproto.py')
-rw-r--r--Lib/asyncio/sslproto.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
index de00953..5cb5cd3 100644
--- a/Lib/asyncio/sslproto.py
+++ b/Lib/asyncio/sslproto.py
@@ -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: