diff options
author | Richard Oudkerk <shibturn@gmail.com> | 2013-10-28 23:02:22 (GMT) |
---|---|---|
committer | Richard Oudkerk <shibturn@gmail.com> | 2013-10-28 23:02:22 (GMT) |
commit | 21aad9792f4f7ebaac76ca552851e937de2e1538 (patch) | |
tree | e43bdfc7764df5342a06b23fdb749050a89c9bf1 /Lib/test | |
parent | 9a2325fac884e3e34af0476e05d6800cfba22ad8 (diff) | |
download | cpython-21aad9792f4f7ebaac76ca552851e937de2e1538.zip cpython-21aad9792f4f7ebaac76ca552851e937de2e1538.tar.gz cpython-21aad9792f4f7ebaac76ca552851e937de2e1538.tar.bz2 |
Issue #19425 -- a pickling error should not cause pool to hang.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_multiprocessing.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py index 579229a..a8928ee 100644 --- a/Lib/test/test_multiprocessing.py +++ b/Lib/test/test_multiprocessing.py @@ -1117,6 +1117,16 @@ class _TestPool(BaseTestCase): self.assertEqual(pmap(sqr, range(100), chunksize=20), map(sqr, range(100))) + def test_map_unplicklable(self): + # Issue #19425 -- failure to pickle should not cause a hang + if self.TYPE == 'threads': + return + class A(object): + def __reduce__(self): + raise RuntimeError('cannot pickle') + with self.assertRaises(RuntimeError): + self.pool.map(sqr, [A()]*10) + def test_map_chunksize(self): try: self.pool.map_async(sqr, [], chunksize=1).get(timeout=TIMEOUT1) |