[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 62bf5d8d0a)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2022-10-24 09:26:32 -07:00 committed by GitHub
parent c4ad3fce66
commit bd8b32b519
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -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: