Explain why this is important

This commit is contained in:
Floris Bruynooghe 2014-08-19 20:50:25 +02:00
parent 424479cf0f
commit e7ed45a5d4
1 changed files with 7 additions and 0 deletions

View File

@ -327,6 +327,13 @@ def rewrite_asserts(mod):
def _saferepr(obj):
"""Get a safe repr of an object for assertion error messages
The assertion formatting (util.format_explanation()) requires
newlines to be escaped since they are a special character for it.
But py.io.saferepr allows newlines, so we need to escape them
here.
"""
repr = py.io.saferepr(obj)
if py.builtin._istext(repr):
t = py.builtin.text