From 83cd4b3c9d3a5bf4e13aea488c4d6cb350471592 Mon Sep 17 00:00:00 2001 From: Kumar Aditya Date: Tue, 18 Mar 2025 09:44:23 +0000 Subject: [PATCH] fix race in closing socket --- Lib/test/test_asyncio/test_ssl.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_asyncio/test_ssl.py b/Lib/test/test_asyncio/test_ssl.py index ac774307c7942b..986ecc2c5a964b 100644 --- a/Lib/test/test_asyncio/test_ssl.py +++ b/Lib/test/test_asyncio/test_ssl.py @@ -1849,16 +1849,14 @@ def stop(self): pass finally: super().stop() - - def run(self): - try: - with self._sock: - self._sock.setblocking(False) - self._run() - finally: + self._sock.close() self._s1.close() self._s2.close() + def run(self): + self._sock.setblocking(False) + self._run() + def _run(self): while self._active: if self._clients >= self._max_clients: