Allow tuple of exceptions in ExceptionInfo.errisinstance
isinstance() accepts it and some code does pass a tuple.
Fixup for commit 55a570e513.
This commit is contained in:
@@ -520,7 +520,9 @@ class ExceptionInfo(Generic[_E]):
|
||||
text = text[len(self._striptext) :]
|
||||
return text
|
||||
|
||||
def errisinstance(self, exc: "Type[BaseException]") -> bool:
|
||||
def errisinstance(
|
||||
self, exc: Union["Type[BaseException]", Tuple["Type[BaseException]", ...]]
|
||||
) -> bool:
|
||||
""" return True if the exception is an instance of exc """
|
||||
return isinstance(self.value, exc)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user