Serhiy Storchaka added the comment: > It depends on sys.getdefaultencoding() which can be modified in the site > module (or in a PYTHONSTARTUP script) using sys.setdefaultencoding().
Of course. Every successful without patch repr() will left same with patch. However the patch allows you to see objects which were not repr-able before. repr() itself is used in the formatting of error messages, so it is desirable extend its aplicability as far as possible. > @Serhiy: it would certainly break a program that tries to call the repr() and > catches the UnicodeEncodeError to do something else, like encode the data > differently. Why it would break? You want encode the data differently.only due non-working repr(), however with proposed patch this will be just not needed. > .__repr__() is not really allowed to return Unicode objects in Python 2.x. If > you do this, you're on your own. PyObject_Repr() contains a code which converts unicode to str and raise an exception if __repr__() result is not str or unicode. Unicode __repr__() is expected even if it is not recommended. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5876> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com