Skip to content

Commit dc1d67d

Browse files
author
Tyler Goodlet
committed
Always force a single value for firstresult hooks
Ensures that wrappers receive a single value instead of a list. Fixes #71
1 parent f087c1e commit dc1d67d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pluggy/callers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ def execute(self):
9797
excinfo = sys.exc_info()
9898
finally:
9999
outcome = _Result(results, excinfo)
100+
if firstresult: # first result hooks return a single value
101+
results = outcome.get_result()
102+
result = results[0] if results else None
103+
outcome.force_result(result)
100104

101105
# run all wrapper post-yield blocks
102106
for gen in reversed(teardowns):
@@ -106,10 +110,6 @@ def execute(self):
106110
except StopIteration:
107111
pass
108112

109-
if firstresult:
110-
result = outcome.get_result()
111-
return result[0] if result else None
112-
113113
return outcome.get_result()
114114

115115
def __repr__(self):

0 commit comments

Comments
 (0)