Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion billiard/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2077,7 +2077,7 @@ def next(self, timeout=None):
success, value = item
if success:
return value
raise Exception(value)
raise value.exception

__next__ = next # XXX

Expand Down
16 changes: 16 additions & 0 deletions t/unit/test_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,22 @@ def test_base_exception_propagates(self):
pool.join()
pool.terminate()

@pytest.mark.parametrize('method', ['imap', 'imap_unordered'])
def test_imap_raises_task_exception(self, method):
# One worker, so imap_unordered() yields in order too.
pool = billiard.pool.Pool(1)
try:
it = getattr(pool, method)(func, range(3))
assert it.next(timeout=10) == 0
assert it.next(timeout=10) == 1
# Used to raise a bare Exception wrapping the ExceptionInfo,
# unlike apply_async().get() and map().
with pytest.raises(ValueError):
it.next(timeout=10)
finally:
pool.terminate()
pool.join()

def test_system_exit_from_task_replaces_worker(self):
pool = billiard.pool.Pool(1)
try:
Expand Down
Loading