cpython: 1ba0deb52223 (original) (raw)

Mercurial > cpython

changeset 100221:1ba0deb52223

Issue #23992: multiprocessing: make MapResult not fail-fast upon exception. [#23992]

Charles-François Natali cf.natali@gmail.com
date Wed, 10 Feb 2016 22:58:18 +0000
parents eae2bb1930c1
children c7eff18f3840
files Lib/multiprocessing/pool.py Lib/test/_test_multiprocessing.py Misc/NEWS
diffstat 3 files changed, 38 insertions(+), 8 deletions(-)[+] [-] Lib/multiprocessing/pool.py 20 Lib/test/_test_multiprocessing.py 24 Misc/NEWS 2

line wrap: on

line diff

--- a/Lib/multiprocessing/pool.py +++ b/Lib/multiprocessing/pool.py @@ -638,22 +638,26 @@ class MapResult(ApplyResult): self._number_left = length//chunksize + bool(length % chunksize) def _set(self, i, success_result):

#

Class whose instances are returned by Pool.imap()

--- a/Lib/test/_test_multiprocessing.py +++ b/Lib/test/_test_multiprocessing.py @@ -1660,6 +1660,10 @@ def sqr(x, wait=0.0): def mul(x, y): return x*y +def raise_large_valuerror(wait):

+ class SayWhenError(ValueError): pass def exception_throwing_generator(total, when): @@ -1895,6 +1899,26 @@ class _TestPool(BaseTestCase): with self.assertRaises(RuntimeError): p.apply(self._test_wrapped_exception)

+

+

+

+ def raising(): raise KeyError("key")

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -179,6 +179,8 @@ Core and Builtins Library ------- +- Issue #23992: multiprocessing: make MapResult not fail-fast upon exception. +