[issue5876] __repr__ returning unicode doesn't work when called implicitly

Serhiy Storchaka report at bugs.python.org
Fri Aug 23 19:15:44 CEST 2013


Serhiy Storchaka added the comment:

How it can break backward compatibility? Currently repr() just raises UnicodeEncodeError.

UnicodeEncodeError: 'ascii' codec can't encode character u'\u20ac' in position 0: ordinal not in range(128)

With patch it always returns 8-bit string. As far as repr() usually used for debugging the second alternative looks more helpful.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5876>
_______________________________________


More information about the Python-bugs-list mailing list