diff options
| author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-04-05 01:48:03 +0200 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-04-05 01:48:03 +0200 |
| commit | f41c2fdbb05ad29ad7c2a6a65dfac2e9d919f022 (patch) | |
| tree | 2c8d484a8a75bf05f7660521aca087c2e825571a /Python/traceback.c | |
| parent | 8136044f569744c1f5fbb37a093e2728db859ee0 (diff) | |
| download | cpython-f41c2fdbb05ad29ad7c2a6a65dfac2e9d919f022.tar.gz | |
Issue #9319: Include the filename in "Non-UTF8 code ..." syntax error.
Diffstat (limited to 'Python/traceback.c')
| -rw-r--r-- | Python/traceback.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/traceback.c b/Python/traceback.c index f0142da792..e74a1474df 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -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 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent) /* 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); |
