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 vstinner
Recipients Rhamphoryncus, amaury.forgeotdarc, eric.araujo, ezio.melotti, lemburg, loewis, vstinner
Date 2010-08-13.01:29:53
SpamBayes Score 6.736347e-08
Marked as misclassified No
Message-id <1281662996.22.0.058861847193.issue9198@psf.upfronthosting.co.za>
In-reply-to
Content
About issue9198.diff:
 - exit directly if !PyErr_ExceptionMatches(PyExc_UnicodeEncodeError) to avoid an useless level of indentation
 - why do you clear the exception before calling PyObject_Repr()? if you cannot execute code while an exception is active, you should maybe save/restore the original exception?
 - the code is long: it can maybe be moved to a subfunction
 - PyObject_CallMethod(buffer, "write", "(O)", encoded) to call write method
 - you can maybe just use strict error handler when you decode the encoded variable: it doesn't work anyway


>>> b"a\xff".decode("ascii", "backslashreplace")
...
TypeError: don't know how to handle UnicodeDecodeError in error callback
>>> b"a\xff".decode("utf-8", "backslashreplace")
...
TypeError: don't know how to handle UnicodeDecodeError in error callback

Note: some encodings don't support backslashreplace, especially mbcs encoding. But on Windows, sys.stdout.encoding is not mbcs but cpXXXX (eg. cp850).
History
Date User Action Args
2010-08-13 01:29:56vstinnersetrecipients: + vstinner, lemburg, loewis, amaury.forgeotdarc, Rhamphoryncus, ezio.melotti, eric.araujo
2010-08-13 01:29:56vstinnersetmessageid: <1281662996.22.0.058861847193.issue9198@psf.upfronthosting.co.za>
2010-08-13 01:29:54vstinnerlinkissue9198 messages
2010-08-13 01:29:53vstinnercreate