Mercurial > cpython-lru_cache-weakref
diff Python/ceval.c @ 64092:05c4baa87549
Issue #9425: save/restore exception on filename encoding
_PyUnicode_AsString() raises an exception on unencodable filename.
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Tue, 17 Aug 2010 00:39:57 +0000 |
| parents | e54baebbd6ff |
| children | 725231211273 |
line wrap: on
line diff
--- a/Python/ceval.c Tue Aug 17 00:04:48 2010 +0000 +++ b/Python/ceval.c Tue Aug 17 00:39:57 2010 +0000 @@ -1213,7 +1213,12 @@ 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;
