Rework ExceptionInfo to not require manual __init__ call

Mypy doesn't like calling __init__() in this way.
This commit is contained in:
Ran Benita
2019-07-11 14:36:13 +03:00
parent 14bf4cdf44
commit 3f1fb62584
2 changed files with 14 additions and 5 deletions

View File

@@ -432,6 +432,11 @@ class ExceptionInfo(Generic[_E]):
"""
return cls(None)
def fill_unfilled(self, exc_info: Tuple["Type[_E]", _E, TracebackType]) -> None:
"""fill an unfilled ExceptionInfo created with for_later()"""
assert self._excinfo is None, "ExceptionInfo was already filled"
self._excinfo = exc_info
@property
def type(self) -> "Type[_E]":
"""the exception class"""