Skip to content

Commit

Permalink
Limit try-except scope in hookwrapper caller
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnikulin committed Jun 30, 2020
1 parent f2ee87a commit bdc131a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pluggy/callers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ def _multicall(hook_impls, caller_kwargs, firstresult=False):
)

if hook_impl.hookwrapper:
gen = hook_impl.function(*args)

try:
gen = hook_impl.function(*args)
next(gen) # first yield
teardowns.append(gen)
except StopIteration:
_raise_wrapfail(gen, "did not yield")

teardowns.append(gen)
else:
res = hook_impl.function(*args)
if res is not None:
Expand Down

0 comments on commit bdc131a

Please sign in to comment.