[Python-checkins] gh-98539: Make _SSLTransportProtocol.abort() safe to call when closed (#104474)

gvanrossum webhook-mailer at python.org
Sun May 14 14:58:20 EDT 2023


https://github.com/python/cpython/commit/fb8739f0b6291fb048a94d6312f59ba4d10a20ca
commit: fb8739f0b6291fb048a94d6312f59ba4d10a20ca
branch: main
author: Sam Bull <git at sambull.org>
committer: gvanrossum <gvanrossum at gmail.com>
date: 2023-05-14T11:58:13-07:00
summary:

gh-98539: Make _SSLTransportProtocol.abort() safe to call when closed (#104474)

files:
M Lib/asyncio/sslproto.py

diff --git a/Lib/asyncio/sslproto.py b/Lib/asyncio/sslproto.py
index bbf9cad6bc7f..488e17d8bccd 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



More information about the Python-checkins mailing list