]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-151522: Guard against None transport in slow-socket SSL test (#151523) main
authorItamar Oren <itamarost@gmail.com>
Tue, 16 Jun 2026 04:51:39 +0000 (21:51 -0700)
committerGitHub <noreply@github.com>
Tue, 16 Jun 2026 04:51:39 +0000 (21:51 -0700)
Lib/test/test_asyncio/test_ssl.py

index ca15fc3bdd42dd7d93480bd61a2304110cfa3920..784c784d261dc6628882da56485bebd85c300ae2 100644 (file)
@@ -1544,6 +1544,9 @@ class TestSSL(test_utils.TestCase):
             # This triggers bug gh-115514, also tested using mocks in
             # test.test_asyncio.test_selector_events.SelectorSocketTransportTests.test_write_buffer_after_close
             socket_transport = writer.transport._ssl_protocol._transport
+            # connection_lost may have already cleared _transport.
+            if socket_transport is None:
+                return
 
             class SocketWrapper:
                 def __init__(self, sock) -> None: