diff options
| author | Jakub KulĂk <Kulikjak@gmail.com> | 2021-11-29 13:02:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-29 14:02:56 +0200 |
| commit | 7431448b817d3bf87f71661cf8f3d537807ab2e2 (patch) | |
| tree | d07aa79542d079c7d9eb35231cb9e0ef91c3084e | |
| parent | b3f443a35e08a473d52868621e9b268259139cb2 (diff) | |
| download | cpython-git-7431448b817d3bf87f71661cf8f3d537807ab2e2.tar.gz | |
bpo-43498: Fix dictionary iteration error in _ExecutorManagerThread (GH-24868)
| -rw-r--r-- | Lib/concurrent/futures/process.py | 2 | ||||
| -rw-r--r-- | Misc/NEWS.d/next/Library/2021-04-20-14-14-16.bpo-43498.L_Hq-8.rst | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py index 19e93a608b..695f773330 100644 --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -400,7 +400,7 @@ class _ExecutorManagerThread(threading.Thread): assert not self.thread_wakeup._closed wakeup_reader = self.thread_wakeup._reader readers = [result_reader, wakeup_reader] - worker_sentinels = [p.sentinel for p in self.processes.values()] + worker_sentinels = [p.sentinel for p in list(self.processes.values())] ready = mp.connection.wait(readers + worker_sentinels) cause = None diff --git a/Misc/NEWS.d/next/Library/2021-04-20-14-14-16.bpo-43498.L_Hq-8.rst b/Misc/NEWS.d/next/Library/2021-04-20-14-14-16.bpo-43498.L_Hq-8.rst new file mode 100644 index 0000000000..4713d1427c --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-04-20-14-14-16.bpo-43498.L_Hq-8.rst @@ -0,0 +1,2 @@ +Avoid a possible *"RuntimeError: dictionary changed size during iteration"* +when adjusting the process count of :class:`ProcessPoolExecutor`. |
