[Python-checkins] r74023 - in python/trunk: Lib/multiprocessing/pool.py Lib/test/test_multiprocessing.py Misc/ACKS Misc/NEWS
jesse.noller
python-checkins at python.org
Thu Jul 16 16:23:04 CEST 2009
Author: jesse.noller
Date: Thu Jul 16 16:23:04 2009
New Revision: 74023
Log:
Issue 6433: multiprocessing.pool.map hangs on empty list
Modified:
python/trunk/Lib/multiprocessing/pool.py
python/trunk/Lib/test/test_multiprocessing.py
python/trunk/Misc/ACKS
python/trunk/Misc/NEWS
Modified: python/trunk/Lib/multiprocessing/pool.py
==============================================================================
--- python/trunk/Lib/multiprocessing/pool.py (original)
+++ python/trunk/Lib/multiprocessing/pool.py Thu Jul 16 16:23:04 2009
@@ -207,6 +207,8 @@
chunksize, extra = divmod(len(iterable), len(self._pool) * 4)
if extra:
chunksize += 1
+ if len(iterable) == 0:
+ chunksize = 0
task_batches = Pool._get_tasks(func, iterable, chunksize)
result = MapResult(self._cache, chunksize, len(iterable), callback)
Modified: python/trunk/Lib/test/test_multiprocessing.py
==============================================================================
--- python/trunk/Lib/test/test_multiprocessing.py (original)
+++ python/trunk/Lib/test/test_multiprocessing.py Thu Jul 16 16:23:04 2009
@@ -990,6 +990,12 @@
self.assertEqual(pmap(sqr, range(100), chunksize=20),
map(sqr, range(100)))
+ def test_map_chunksize(self):
+ try:
+ self.pool.map_async(sqr, [], chunksize=1).get(timeout=TIMEOUT1)
+ except multiprocessing.TimeoutError:
+ self.fail("pool.map_async with chunksize stalled on null list")
+
def test_async(self):
res = self.pool.apply_async(sqr, (7, TIMEOUT1,))
get = TimingWrapper(res.get)
Modified: python/trunk/Misc/ACKS
==============================================================================
--- python/trunk/Misc/ACKS (original)
+++ python/trunk/Misc/ACKS Thu Jul 16 16:23:04 2009
@@ -199,6 +199,7 @@
Hans Eckardt
Grant Edwards
John Ehresman
+Eric Eisner
Andrew Eland
Lance Ellinghaus
David Ely
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS (original)
+++ python/trunk/Misc/NEWS Thu Jul 16 16:23:04 2009
@@ -352,6 +352,8 @@
Library
-------
+- Issue #6433: fixed issues with multiprocessing.pool.map hanging on empty list
+
- Issue #6314: logging: Extra checks on the "level" argument in more places.
- Issue #2622: Fixed an ImportError when importing email.messsage from a
More information about the Python-checkins
mailing list