Fix _Py_DisplaySourceLine(), if PyTokenizer_FindEncodingFilename() fails, clear
the exception to not call open() with an exception set.
diff --git a/Python/traceback.c b/Python/traceback.c
index e9169ce..2ece192 100644
--- 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) {