Fix multiprocessing starmap to allow passing in zip (#13664)

This commit is contained in:
Rand Xie
2021-01-26 14:15:35 -08:00
committed by GitHub
parent 2f482193b9
commit 4f4e1b664b
2 changed files with 2 additions and 1 deletions
+1
View File
@@ -340,6 +340,7 @@ def test_starmap(pool):
args = [tuple(range(i)) for i in range(100)]
assert pool.starmap(f, args) == args
assert pool.starmap(lambda x, y: x + y, zip([1, 2], [3, 4])) == [4, 6]
def test_callbacks(pool_4_processes):
+1 -1
View File
@@ -494,7 +494,7 @@ class Pool:
def _chunk_and_run(self, func, iterable, chunksize=None,
unpack_args=False):
if not hasattr(iterable, "__len__"):
iterable = [iterable]
iterable = list(iterable)
if chunksize is None:
chunksize = self._calculate_chunksize(iterable)