Message196008
> 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:23 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, lemburg, arigo, vstinner, ezio.melotti, eric.araujo, r.david.murray, liori, Nam.Nguyen |
2013-08-23 19:12:23 | serhiy.storchaka | set | messageid: <1377285143.64.0.650622578265.issue5876@psf.upfronthosting.co.za> |
2013-08-23 19:12:23 | serhiy.storchaka | link | issue5876 messages |
2013-08-23 19:12:23 | serhiy.storchaka | create | |
|