This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients Nam.Nguyen, arigo, eric.araujo, ezio.melotti, lemburg, liori, r.david.murray, serhiy.storchaka, vstinner
Date 2013-08-23.19:12:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> 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.
Date User Action Args
2013-08-23 19:12:23serhiy.storchakasetrecipients: + serhiy.storchaka, lemburg, arigo, vstinner, ezio.melotti, eric.araujo, r.david.murray, liori, Nam.Nguyen
2013-08-23 19:12:23serhiy.storchakasetmessageid: <>
2013-08-23 19:12:23serhiy.storchakalinkissue5876 messages
2013-08-23 19:12:23serhiy.storchakacreate