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:
Ran Benita 2019-07-16 23:25:13 +03:00
parent 104f8fc836
commit 8d413c1926
1 changed files with 3 additions and 1 deletions

View File

@ -520,7 +520,9 @@ class ExceptionInfo(Generic[_E]):
text = text[len(self._striptext) :] text = text[len(self._striptext) :]
return text 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 True if the exception is an instance of exc """
return isinstance(self.value, exc) return isinstance(self.value, exc)