Mercurial > cpython-lru_cache-weakref
diff Python/traceback.c @ 69148:7b8d625eb6e4
Issue #9319: Include the filename in "Non-UTF8 code ..." syntax error.
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Tue, 05 Apr 2011 01:48:03 +0200 |
| parents | 7e3ed426962f |
| children | 8beaa9a37387 |
line wrap: on
line diff
--- a/Python/traceback.c Tue Apr 05 00:39:01 2011 +0200 +++ b/Python/traceback.c Tue Apr 05 01:48:03 2011 +0200 @@ -18,8 +18,8 @@ #define MAX_FRAME_DEPTH 100 #define MAX_NTHREADS 100 -/* Method from Parser/tokenizer.c */ -extern char * PyTokenizer_FindEncoding(int); +/* Function from Parser/tokenizer.c */ +extern char * PyTokenizer_FindEncodingFilename(int, PyObject *); static PyObject * tb_dir(PyTracebackObject *self) @@ -251,7 +251,7 @@ /* use the right encoding to decode the file as unicode */ fd = PyObject_AsFileDescriptor(binary); - found_encoding = PyTokenizer_FindEncoding(fd); + found_encoding = PyTokenizer_FindEncodingFilename(fd, filename); encoding = (found_encoding != NULL) ? found_encoding : "utf-8"; lseek(fd, 0, 0); /* Reset position */ fob = PyObject_CallMethod(io, "TextIOWrapper", "Os", binary, encoding);
