[Python-checkins] GH-98539: fix ref cycle in `_SSLProtocolTransport` after close (#98540)
gvanrossum
webhook-mailer at python.org
Sat Oct 22 12:11:32 EDT 2022
https://github.com/python/cpython/commit/62bf5d8d0a36112619436a813ceefb7e4af52c24
commit: 62bf5d8d0a36112619436a813ceefb7e4af52c24
branch: main
author: Kumar Aditya <59607654+kumaraditya303 at users.noreply.github.com>
committer: gvanrossum <gvanrossum at gmail.com>
date: 2022-10-22T09:11:27-07:00
summary:
GH-98539: fix ref cycle in `_SSLProtocolTransport` after close (#98540)
files:
M Lib/asyncio/sslproto.py
diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
index de00953cc1d0..5cb5cd35883f 100644
--- a/Lib/asyncio/sslproto.py
+++ b/Lib/asyncio/sslproto.py
@@ -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:
More information about the Python-checkins
mailing list