use safe_str to serialize Exceptions Fixes #5478

This commit is contained in:
Thomas Grainger
2019-06-25 12:40:07 +01:00
parent 554bff8cc1
commit 013d0e66c7
3 changed files with 8 additions and 2 deletions

View File

@@ -572,8 +572,9 @@ class ExceptionInfo(object):
raised.
"""
__tracebackhide__ = True
if not re.search(regexp, str(self.value)):
assert 0, "Pattern '{!s}' not found in '{!s}'".format(regexp, self.value)
value = safe_str(self.value)
if not re.search(regexp, value):
assert 0, "Pattern '{!s}' not found in '{!s}'".format(regexp, value)
return True