[Python-checkins] cpython: Fix _Py_DisplaySourceLine(), if PyTokenizer_FindEncodingFilename() fails, clear
victor.stinner
python-checkins at python.org
Thu Dec 19 13:40:00 CET 2013
http://hg.python.org/cpython/rev/298d98486794
changeset: 88057:298d98486794
user: Victor Stinner <victor.stinner at gmail.com>
date: Thu Dec 19 13:39:32 2013 +0100
summary:
Fix _Py_DisplaySourceLine(), if PyTokenizer_FindEncodingFilename() fails, clear
the exception to not call open() with an exception set.
files:
Python/traceback.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/Python/traceback.c b/Python/traceback.c
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -264,6 +264,8 @@
return 0;
}
found_encoding = PyTokenizer_FindEncodingFilename(fd, filename);
+ if (found_encoding == NULL)
+ PyErr_Clear();
encoding = (found_encoding != NULL) ? found_encoding : "utf-8";
/* Reset position */
if (lseek(fd, 0, SEEK_SET) == (off_t)-1) {
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list