Skip to content

Commit 4018209

Browse files
[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 0b4e090)
1 parent 5a8e6f8 commit 4018209

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Diff for: Lib/concurrent/futures/process.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,8 @@ def _terminate_broken(self, cause):
526526

527527
# gh-107219: Close the connection writer which can unblock
528528
# Queue._feed() if it was stuck in send_bytes().
529-
self.call_queue._writer.close()
529+
if sys.platform == 'win32':
530+
self.call_queue._writer.close()
530531

531532
# clean up resources
532533
self._join_executor_internals(broken=True)

Diff for: 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)