From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 26 Sep 2023 08:21:09 +0000 (-0700) Subject: [3.11] gh-109370: Fix unexpected traceback output in test_concurrent_futures (GH... X-Git-Tag: v3.11.6~43 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8fef834f055d6c6311d022eba2a8a22b4348fa95;p=thirdparty%2FPython%2Fcpython.git [3.11] gh-109370: Fix unexpected traceback output in test_concurrent_futures (GH-109780) (GH-109882) 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 --- diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py index 30a7ac8e6fe8..952fa9034574 100644 --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -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() diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py index 63c6596b77cd..8b81f9954e47 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.