Message76125
I think I got the point: to decode strings like "\N{CHARACTER NAME}"
PyUnicode_DecodeUnicodeEscape imports the unicodedata module.
If this fails, PyErr_SetString(PyExc_UnicodeError, "some message")
is called.
The exception will eventually be caught by ast_for_atom (in
Python/ast.c), but the exception there is not normalized: type is
PyExc_UnicodeError when the value is a string. Hence the invalid cast.
The exception cannot be normalized there: UnicodeError.__init__ needs 5
arguments.
I think the error was to call PyErr_SetString in the first place.
The attached patch replaces it with PyErr_SetObject and a full
UnicodeDecodeError object.
This deserves a unit test, but I wonder how to reliably make the import
fail. |
|
Date |
User |
Action |
Args |
2008-11-20 18:39:34 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc, benjamin.peterson, ot |
2008-11-20 18:39:34 | amaury.forgeotdarc | set | messageid: <1227206374.72.0.0450128006451.issue4367@psf.upfronthosting.co.za> |
2008-11-20 18:39:32 | amaury.forgeotdarc | link | issue4367 messages |
2008-11-20 18:39:32 | amaury.forgeotdarc | create | |
|