Skip to content

Commit 7431448

Browse files
authored
bpo-43498: Fix dictionary iteration error in _ExecutorManagerThread (GH-24868)
1 parent b3f443a commit 7431448

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Lib/concurrent/futures/process.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def wait_result_broken_or_wakeup(self):
400400
assert not self.thread_wakeup._closed
401401
wakeup_reader = self.thread_wakeup._reader
402402
readers = [result_reader, wakeup_reader]
403-
worker_sentinels = [p.sentinel for p in self.processes.values()]
403+
worker_sentinels = [p.sentinel for p in list(self.processes.values())]
404404
ready = mp.connection.wait(readers + worker_sentinels)
405405

406406
cause = None
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Avoid a possible *"RuntimeError: dictionary changed size during iteration"*
2+
when adjusting the process count of :class:`ProcessPoolExecutor`.

0 commit comments

Comments
 (0)