Skip to content

Commit 3b9d886

Browse files
bpo-43498: Fix dictionary iteration error in _ExecutorManagerThread (GH-24868)
(cherry picked from commit 7431448) Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
1 parent 5b6aa6c commit 3b9d886

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Lib/concurrent/futures/process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def wait_result_broken_or_wakeup(self):
373373
assert not self.thread_wakeup._closed
374374
wakeup_reader = self.thread_wakeup._reader
375375
readers = [result_reader, wakeup_reader]
376-
worker_sentinels = [p.sentinel for p in self.processes.values()]
376+
worker_sentinels = [p.sentinel for p in list(self.processes.values())]
377377
ready = mp.connection.wait(readers + worker_sentinels)
378378

379379
cause = None
Lines changed: 2 additions & 0 deletions
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)