Skip to content

Commit c0e8c83

Browse files
Result.from_call: remove type ambiguity for exception/result locals
1 parent 1f48444 commit c0e8c83

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pluggy/_result.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ def exception(self) -> BaseException | None:
5757
def from_call(cls, func: Callable[[], ResultType]) -> Result[ResultType]:
5858
""":meta private:"""
5959
__tracebackhide__ = True
60-
result = exception = None
6160
try:
6261
result = func()
6362
except BaseException as exc:
64-
exception = exc
65-
return cls(result, exception)
63+
return cls(None, exc)
64+
else:
65+
return cls(result, None)
6666

6767
def force_result(self, result: ResultType) -> None:
6868
"""Force the result(s) to ``result``.

0 commit comments

Comments
 (0)