Author: victor.stinner Date: Fri Jul 30 00:57:23 2010 New Revision: 83245 Log: err_input() uses PyUnicode_DecodeFSDefault() to decode the input filename Modified: python/branches/import_unicode/Python/pythonrun.c Modified: python/branches/import_unicode/Python/pythonrun.c ============================================================================== --- python/branches/import_unicode/Python/pythonrun.c (original) +++ python/branches/import_unicode/Python/pythonrun.c Fri Jul 30 00:57:23 2010 @@ -2088,6 +2088,8 @@ PyObject *v, *w, *errtype, *errtext; PyObject *msg_obj = NULL; char *msg = NULL; + PyObject *filename; + errtype = PyExc_SyntaxError; switch (err->error) { case E_ERROR: @@ -2171,8 +2173,17 @@ errtext = PyUnicode_DecodeUTF8(err->text, strlen(err->text), "replace"); } - v = Py_BuildValue("(ziiN)", err->filename, - err->lineno, err->offset, errtext); + if (err->filename != NULL) + filename = PyUnicode_DecodeFSDefault(err->filename); + else { + Py_INCREF(Py_None); + filename = Py_None; + } + if (filename != NULL) + v = Py_BuildValue("(NiiN)", filename, + err->lineno, err->offset, errtext); + else + v = NULL; if (v != NULL) { if (msg_obj) w = Py_BuildValue("(OO)", msg_obj, v);
participants (1)
-
victor.stinner