]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-128002: fix tsan race in closing socket in `test_sslproto` (#131399)
authorKumar Aditya <kumaraditya@python.org>
Tue, 18 Mar 2025 10:50:47 +0000 (16:20 +0530)
committerGitHub <noreply@github.com>
Tue, 18 Mar 2025 10:50:47 +0000 (16:20 +0530)
Lib/test/test_asyncio/functional.py

index 2934325b6dfbc759cad5e3f22682ab51b8ad4930..555394b915de4832c163549053f9ecce42d8d1bd 100644 (file)
@@ -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: