[Python-Dev] unicode Exception messages in py2.7
chris.barker at noaa.gov
Mon Nov 18 18:15:32 CET 2013
It seems changing anything about how Exception messages are handles is off
the table for 2.7, and a non-issue in 3.*
Is it worth opening an issue on this, just so we can close it as won't fix?
Or is this thread documentation enough?
NOTE about py3: I'm assuming unicode messages are handled properly, as
unicode is the default text in py3. However, this has got me thinking about
how Exception messages are handled in general. I'm still not clear on where
it tries to convert to a string -- it seems to do different things
depending on whether you are running on the console, or using the traceback
module's print_exception function. I'm thinking that perhaps Exception
messages should be as generic as possible. i.e allow any python object as
an Exception message, and simple pass that off to whatever wants to
do something with it. So far, that seems to be happening with the
traceback.print_exception message, but I'm not sure where that conversion
is happening in the console report -- clearly it's not using
traceback.print_exception, but it is doing it before a final simple:
at the console. But perhaps it should defer to that last step, i.e. out of
the Exception handling code altogether. (or maybe py3 already does that --
in which case, never mind).
On Fri, Nov 15, 2013 at 3:58 PM, Greg Ewing <greg.ewing at canterbury.ac.nz>wrote:
> Armin Rigo wrote:
>> I figured that even using the traceback.py module and getting
>> "Exception: \u1234\u1235\u5321" is rather useless if you tried to
>> raise an exception with a message in Thai.
> But at least it tells you that *something* went wrong,
> and points to the place in the code where it happened.
> That has to be better than pretending that nothing
> happened at all.
> Also, if the escaping preserves the original byte
> sequence of the message, there's a chance that someone
> will be able to figure out what the message said.
> Python-Dev mailing list
> Python-Dev at python.org
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
Christopher Barker, Ph.D.
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-Dev