bpo-43498: Fix dictionary iteration error in _ExecutorManagerThread (GH-24868)

This commit is contained in:
Jakub Kulík 2021-11-29 13:02:56 +01:00 committed by GitHub
parent b3f443a35e
commit 7431448b81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -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

View File

@ -0,0 +1,2 @@
Avoid a possible *"RuntimeError: dictionary changed size during iteration"*
when adjusting the process count of :class:`ProcessPoolExecutor`.