(original) (raw)

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?

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).

-Chris












-Chris




On Fri, Nov 15, 2013 at 3:58 PM, Greg Ewing <greg.ewing@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.Barker@noaa.gov