ExceptionInfo.from_current: assert current exception

This commit is contained in:
Daniel Hahler
2019-03-23 00:29:36 +01:00
parent 15d608867d
commit 2d690b83bf
2 changed files with 5 additions and 0 deletions

View File

@@ -413,6 +413,7 @@ class ExceptionInfo(object):
to the exception message/``__str__()``
"""
tup = sys.exc_info()
assert tup[0] is not None, "no current exception"
_striptext = ""
if exprinfo is None and isinstance(tup[1], AssertionError):
exprinfo = getattr(tup[1], "msg", None)