Commit 02710bc3 authored by Jason Madden's avatar Jason Madden

Merge pull request #512 from adieu/master

gevent.greenlet.joinall ignored `count` when `raise_error` was False
parents 9c7e8e0b 1ec46d17
......@@ -410,7 +410,7 @@ def _kill(greenlet, exception, waiter):
def joinall(greenlets, timeout=None, raise_error=False, count=None):
if not raise_error:
wait(greenlets, timeout=timeout)
wait(greenlets, timeout=timeout, count=count)
else:
for obj in iwait(greenlets, timeout=timeout):
if getattr(obj, 'exception', None) is not None:
......
......@@ -288,6 +288,26 @@ class TestStuff(greentest.TestCase):
assert 'second' in str(ex), repr(str(ex))
gevent.joinall([a, b])
def test_joinall_count_raise_error(self):
# When joinall is asked not to raise an error, the 'count' param still
# works.
def raises_but_ignored():
raise ExpectedError("count")
def sleep_forever():
while True:
sleep(0.1)
sleeper = gevent.spawn(sleep_forever)
raiser = gevent.spawn(raises_but_ignored)
gevent.joinall([sleeper, raiser], raise_error=False, count=1)
assert_ready(raiser)
assert_not_ready(sleeper)
# Clean up our mess
sleeper.kill()
assert_ready(sleeper)
def test_multiple_listeners_error(self):
# if there was an error while calling a callback
# it should not prevent the other listeners from being called
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment