summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-08-17 00:39:57 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-08-17 00:39:57 (GMT)
commit4a3733d16021cdf8f924bf65b7658dbf46da9ea4 (patch)
tree493a3481d0979480cf7bd65d35d4724acf6eb704 /Python/ceval.c
parent028dd97dfbabd14687bca109d6328fc734e48eeb (diff)
downloadcpython-4a3733d16021cdf8f924bf65b7658dbf46da9ea4.zip
cpython-4a3733d16021cdf8f924bf65b7658dbf46da9ea4.tar.gz
cpython-4a3733d16021cdf8f924bf65b7658dbf46da9ea4.tar.bz2
Issue #9425: save/restore exception on filename encoding
_PyUnicode_AsString() raises an exception on unencodable filename.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index c2c4e78..4d583a5 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;