diff -r 23746eb968f6 Lib/multiprocessing/pool.py --- a/Lib/multiprocessing/pool.py Tue Jul 07 12:21:03 2009 +0200 +++ b/Lib/multiprocessing/pool.py Tue Jul 07 20:34:58 2009 +0900 @@ -209,6 +209,9 @@ 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) self._taskqueue.put((((result._job, i, mapstar, (x,), {}) diff -r 23746eb968f6 Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py Tue Jul 07 12:21:03 2009 +0200 +++ b/Lib/test/test_multiprocessing.py Tue Jul 07 20:34:58 2009 +0900 @@ -990,6 +990,12 @@ self.assertEqual(pmap(sqr, list(range(100)), chunksize=20), list(map(sqr, list(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)