From 902e72dd21b95805c7fc4fb776bfa7822ea4923f Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Sun, 14 May 2023 12:08:27 +0100 Subject: [PATCH] Make _SSLTransportProtocol.abort() safe to call when closed --- Lib/asyncio/sslproto.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py index bbf9cad6bc7f86..488e17d8bccd5b 100644 --- a/Lib/asyncio/sslproto.py +++ b/Lib/asyncio/sslproto.py @@ -244,7 +244,8 @@ def abort(self): called with None as its argument. """ self._closed = True - self._ssl_protocol._abort() + if self._ssl_protocol is not None: + self._ssl_protocol._abort() def _force_close(self, exc): self._closed = True