Mercurial > cpython-lru_cache-weakref
diff Python/import.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 | 5deb2094f033 |
| children | e4e92d68ba3a |
line wrap: on
line diff
--- a/Python/import.c Tue Apr 05 00:39:01 2011 +0200 +++ b/Python/import.c Tue Apr 05 01:48:03 2011 +0200 @@ -124,12 +124,12 @@ /* See _PyImport_FixupExtensionObject() below */ static PyObject *extensions = NULL; +/* Function from Parser/tokenizer.c */ +extern char * PyTokenizer_FindEncodingFilename(int, PyObject *); + /* This table is defined in config.c: */ extern struct _inittab _PyImport_Inittab[]; -/* Method from Parser/tokenizer.c */ -extern char * PyTokenizer_FindEncoding(int); - struct _inittab *PyImport_Inittab = _PyImport_Inittab; /* these tables define the module suffixes that Python recognizes */ @@ -3540,9 +3540,9 @@ } if (fd != -1) { if (strchr(fdp->mode, 'b') == NULL) { - /* PyTokenizer_FindEncoding() returns PyMem_MALLOC'ed + /* PyTokenizer_FindEncodingFilename() returns PyMem_MALLOC'ed memory. */ - found_encoding = PyTokenizer_FindEncoding(fd); + found_encoding = PyTokenizer_FindEncodingFilename(fd, pathobj); lseek(fd, 0, 0); /* Reset position */ if (found_encoding == NULL && PyErr_Occurred()) { Py_XDECREF(pathobj);
