diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2023-11-10 07:17:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 07:17:02 (GMT) |
commit | 4018209fff7ba1be3cc1f919f0bebc931febbf82 (patch) | |
tree | 0f720a3b60affdf14f40b075453fd21f6a684a08 | |
parent | 5a8e6f8bccd7048e592f6bd45af503ce3fac95dd (diff) | |
download | cpython-4018209fff7ba1be3cc1f919f0bebc931febbf82.zip cpython-4018209fff7ba1be3cc1f919f0bebc931febbf82.tar.gz cpython-4018209fff7ba1be3cc1f919f0bebc931febbf82.tar.bz2 |
[3.12] gh-109370: Fix unexpected traceback output in test_concurrent_futures (GH-109780) (GH-111934)
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)
-rw-r--r-- | Lib/concurrent/futures/process.py | 3 | ||||
-rw-r--r-- | Lib/multiprocessing/connection.py | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py index 8359a4f..33e62fe 100644 --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -526,7 +526,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(broken=True) diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py index 7c425a2..dbbf106 100644 --- a/Lib/multiprocessing/connection.py +++ b/Lib/multiprocessing/connection.py @@ -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. |