On Mon, Nov 18, 2013 at 12:15 PM, Chris Barker <chris.bar...@noaa.gov>wrote:

> Folks,
>
> 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?
>

A closed bug wouldn't hurt, but I wouldn't view it as necessary.


>
> 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:
>
> print exp.message
>
> 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).
>
>
The conversion is probably happening in Exception.__str__ (don't know about
the traceback module w/o looking at it; probably skipping `str(exc)` and
building the string from scratch).

-Brett


> -Chris
>
>
>
>
>
>
>
>
>
>
>
>
> -Chris
>
>
>
>
> On Fri, Nov 15, 2013 at 3:58 PM, Greg Ewing 
> <greg.ew...@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.
>>
>> --
>> Greg
>>
>> _______________________________________________
>> Python-Dev mailing list
>> Python-Dev@python.org
>> https://mail.python.org/mailman/listinfo/python-dev
>> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
>> chris.barker%40noaa.gov
>>
>
>
>
> --
>
> Christopher Barker, Ph.D.
> Oceanographer
>
> 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.bar...@noaa.gov
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/brett%40python.org
>
>
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to