Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

greenpool: Make sure that imap/starmap set the correct pool #215

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion eventlet/greenpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def starmap(self, function, iterable):
"""
if function is None:
function = lambda *a: a
gi = GreenMap(self.size)
gi = GreenMap(self)
greenthread.spawn_n(self._do_map, function, iterable, gi)
return gi

Expand Down
6 changes: 6 additions & 0 deletions tests/greenpool_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,12 @@ def test_waitall_on_nothing(self):
p = greenpool.GreenPool()
p.waitall()

def test_imap_sets_pool(self):
p = greenpool.GreenPool(4)
pile = p.imap(passthru, list(range(10)))
self.assertTrue(p is pile.pool)
p.waitall()

def test_recursive_waitall(self):
p = greenpool.GreenPool()
gt = p.spawn(p.waitall)
Expand Down