From ab6333f7f56554bfd6c01eff567ddfb163a3dae6 Mon Sep 17 00:00:00 2001 From: Kumar Aditya Date: Tue, 18 Mar 2025 16:20:47 +0530 Subject: gh-128002: fix tsan race in closing socket in `test_sslproto` (#131399) --- Lib/test/test_asyncio/functional.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'Lib/test/test_asyncio/functional.py') diff --git a/Lib/test/test_asyncio/functional.py b/Lib/test/test_asyncio/functional.py index 2934325b6df..555394b915d 100644 --- a/Lib/test/test_asyncio/functional.py +++ b/Lib/test/test_asyncio/functional.py @@ -217,16 +217,15 @@ class TestThreadedServer(SocketThread): 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: -- cgit v1.2.3