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 brett.cannon, eric.araujo, georg.brandl, ncoghlan, python-dev, terry.reedy, vstinner
Date 2011-03-23.23:18:52
SpamBayes Score 3.2304527e-08
Marked as misclassified No
Message-id <1300922333.27.0.577202295753.issue8754@psf.upfronthosting.co.za>
In-reply-to
Content
I patched import.c to use repr() instead of str() (%R instead of %U) to format module names because they might contain surrogate characters. Surrogate characters are not encodable to any encoding, except UTF-16 and UTF-32. And so print an exception to stdout may produce an UnicodeEncodeError. At the same time... exceptions are printed to stderr which uses the backslashreplace error handler, and so the message *can* be printed:

$ python3.1
>>> raise Exception('x\uDC80y')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
Exception: x\udc80y

So now I realized that my change was maybe useless.
History
Date User Action Args
2011-03-23 23:18:53vstinnersetrecipients: + vstinner, brett.cannon, georg.brandl, terry.reedy, ncoghlan, eric.araujo, python-dev
2011-03-23 23:18:53vstinnersetmessageid: <1300922333.27.0.577202295753.issue8754@psf.upfronthosting.co.za>
2011-03-23 23:18:52vstinnerlinkissue8754 messages
2011-03-23 23:18:52vstinnercreate