From: Victor Stinner Date: Tue, 17 Aug 2010 00:39:57 +0000 (+0000) Subject: Issue #9425: save/restore exception on filename encoding X-Git-Tag: v3.2a2~269 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4a3733d16021cdf8f924bf65b7658dbf46da9ea4;p=python Issue #9425: save/restore exception on filename encoding _PyUnicode_AsString() raises an exception on unencodable filename. --- diff --git a/Python/ceval.c b/Python/ceval.c index c2c4e78f19..4d583a57de 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1213,7 +1213,12 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) lltrace = PyDict_GetItemString(f->f_globals, "__lltrace__") != NULL; #endif #if defined(Py_DEBUG) || defined(LLTRACE) - filename = _PyUnicode_AsString(co->co_filename); + { + PyObject *error_type, *error_value, *error_traceback; + PyErr_Fetch(&error_type, &error_value, &error_traceback); + filename = _PyUnicode_AsString(co->co_filename); + PyErr_Restore(error_type, error_value, error_traceback); + } #endif why = WHY_NOT;