Skip to content

Commit 0b4e090

Browse files
authoredSep 26, 2023
pythongh-109370: Fix unexpected traceback output in test_concurrent_futures (pythonGH-109780)
Follow-up of pythongh-107219. * Only close the connection writer on Windows. * Also use existing constant _winapi.ERROR_OPERATION_ABORTED instead of WSA_OPERATION_ABORTED.
1 parent 4091deb commit 0b4e090

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎Lib/concurrent/futures/process.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,8 @@ def terminate_broken(self, cause):
521521

522522
# gh-107219: Close the connection writer which can unblock
523523
# Queue._feed() if it was stuck in send_bytes().
524-
self.call_queue._writer.close()
524+
if sys.platform == 'win32':
525+
self.call_queue._writer.close()
525526

526527
# clean up resources
527528
self.join_executor_internals()

‎Lib/multiprocessing/connection.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
BUFSIZE = 8192
4343
# A very generous timeout when it comes to local connections...
4444
CONNECTION_TIMEOUT = 20.
45-
WSA_OPERATION_ABORTED = 995
4645

4746
_mmap_counter = itertools.count()
4847

@@ -300,7 +299,7 @@ def _send_bytes(self, buf):
300299
finally:
301300
self._send_ov = None
302301
nwritten, err = ov.GetOverlappedResult(True)
303-
if err == WSA_OPERATION_ABORTED:
302+
if err == _winapi.ERROR_OPERATION_ABORTED:
304303
# close() was called by another thread while
305304
# WaitForMultipleObjects() was waiting for the overlapped
306305
# operation.

0 commit comments

Comments
 (0)
Please sign in to comment.