summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-10-25 04:04:37 (GMT)
committerBenjamin Peterson <benjamin@python.org>2011-10-25 04:04:37 (GMT)
commit9a1b956deaddb06341d6cbfa16af9d4eee196e99 (patch)
treedce21295fb88932b9cdfdf5e082c07b8fd4ae1ca /Lib/test
parent1fafc1a11f7d4799f252a40e608b0fd4d4fedb68 (diff)
parent64c1c0720170dbd78dbac333d4c268439ac856bc (diff)
downloadcpython-9a1b956deaddb06341d6cbfa16af9d4eee196e99.zip
cpython-9a1b956deaddb06341d6cbfa16af9d4eee196e99.tar.gz
cpython-9a1b956deaddb06341d6cbfa16af9d4eee196e99.tar.bz2
merge heads
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_multiprocessing.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
index 6940d0e..45bf454 100644
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -1217,6 +1217,20 @@ class _TestPoolWorkerLifetime(BaseTestCase):
p.close()
p.join()
+ def test_pool_worker_lifetime_early_close(self):
+ # Issue #10332: closing a pool whose workers have limited lifetimes
+ # before all the tasks completed would make join() hang.
+ p = multiprocessing.Pool(3, maxtasksperchild=1)
+ results = []
+ for i in range(6):
+ results.append(p.apply_async(sqr, (i, 0.3)))
+ p.close()
+ p.join()
+ # check the results
+ for (j, res) in enumerate(results):
+ self.assertEqual(res.get(), sqr(j))
+
+
#
# Test that manager has expected number of shared objects left
#