Skip to content

Commit

Permalink
use safe_str to serialize Exceptions Fixes #5478
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Jun 25, 2019
1 parent 4b104ba commit 78f0427
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/_pytest/_code/code.py
Expand Up @@ -572,8 +572,9 @@ def match(self, regexp):
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 {!r} not found in {!r}".format(regexp, value)
return True


Expand Down

0 comments on commit 78f0427

Please sign in to comment.