WIP: bpo-35478: pool terminated by vstinner · Pull Request #11139 · python/cpython

Expand Up @@ -616,6 +616,9 @@ def _terminate_pool(cls, taskqueue, inqueue, outqueue, pool, if threading.current_thread() is not result_handler: result_handler.join()
for result in list(cache.values()): result._pool_terminated()
if pool and hasattr(pool[0], 'terminate'): util.debug('joining pool workers') for p in pool: Expand Down Expand Up @@ -674,6 +677,11 @@ def _set(self, i, obj): self._event.set() del self._cache[self._job]
def _pool_terminated(self): exc = RuntimeError("Pool terminated") self._set(0, (False, exc))

AsyncResult = ApplyResult # create alias -- see #17805
# Expand Down Expand Up @@ -717,6 +725,13 @@ def _set(self, i, success_result): del self._cache[self._job] self._event.set()
def _pool_terminated(self): value = self._value exc = RuntimeError("Pool terminated") for i in range(0, len(value), self._chunksize): if value[i] is None: self._set(i, (False, exc))
# # Class whose instances are returned by `Pool.imap()` # Expand Down