]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-109370: Fix unexpected traceback output in test_concurrent_futures (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 26 Sep 2023 08:21:09 +0000 (01:21 -0700)
committerGitHub <noreply@github.com>
Tue, 26 Sep 2023 08:21:09 +0000 (11:21 +0300)
Follow-up of gh-107219.

* Only close the connection writer on Windows.
* Also use existing constant _winapi.ERROR_OPERATION_ABORTED instead of
  WSA_OPERATION_ABORTED.
(cherry picked from commit 0b4e090422db5f959184353d53552d1675f74212)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/concurrent/futures/process.py
Lib/multiprocessing/connection.py

index 30a7ac8e6fe886235bf8aa3d83d526f7b3c4149a..952fa9034574bc1b2566d843a7da3b06fec2836d 100644 (file)
@@ -512,7 +512,8 @@ class _ExecutorManagerThread(threading.Thread):
 
         # gh-107219: Close the connection writer which can unblock
         # Queue._feed() if it was stuck in send_bytes().
-        self.call_queue._writer.close()
+        if sys.platform == 'win32':
+            self.call_queue._writer.close()
 
         # clean up resources
         self.join_executor_internals()
index 63c6596b77cd147494472df68ca9bb17437cadd7..8b81f9954e47933c1b067a7ccfa267c02a6f7060 100644 (file)
@@ -42,7 +42,6 @@ except ImportError:
 BUFSIZE = 8192
 # A very generous timeout when it comes to local connections...
 CONNECTION_TIMEOUT = 20.
-WSA_OPERATION_ABORTED = 995
 
 _mmap_counter = itertools.count()
 
@@ -300,7 +299,7 @@ if _winapi:
             finally:
                 self._send_ov = None
                 nwritten, err = ov.GetOverlappedResult(True)
-            if err == WSA_OPERATION_ABORTED:
+            if err == _winapi.ERROR_OPERATION_ABORTED:
                 # close() was called by another thread while
                 # WaitForMultipleObjects() was waiting for the overlapped
                 # operation.