mirror of
https://github.com/python/cpython.git
synced 2025-09-09 18:32:22 +00:00
Close #11619: The parser and the import machinery do not encode Unicode
filenames anymore on Windows.
This commit is contained in:
parent
33824f6fd7
commit
14e461d5b9
22 changed files with 514 additions and 175 deletions
|
@ -579,8 +579,7 @@ static PyObject *
|
|||
builtin_compile(PyObject *self, PyObject *args, PyObject *kwds)
|
||||
{
|
||||
char *str;
|
||||
PyObject *filename_obj;
|
||||
char *filename;
|
||||
PyObject *filename;
|
||||
char *startstr;
|
||||
int mode = -1;
|
||||
int dont_inherit = 0;
|
||||
|
@ -596,12 +595,11 @@ builtin_compile(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&s|iii:compile", kwlist,
|
||||
&cmd,
|
||||
PyUnicode_FSConverter, &filename_obj,
|
||||
PyUnicode_FSDecoder, &filename,
|
||||
&startstr, &supplied_flags,
|
||||
&dont_inherit, &optimize))
|
||||
return NULL;
|
||||
|
||||
filename = PyBytes_AS_STRING(filename_obj);
|
||||
cf.cf_flags = supplied_flags | PyCF_SOURCE_IS_UTF8;
|
||||
|
||||
if (supplied_flags &
|
||||
|
@ -659,8 +657,8 @@ builtin_compile(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
PyArena_Free(arena);
|
||||
goto error;
|
||||
}
|
||||
result = (PyObject*)PyAST_CompileEx(mod, filename,
|
||||
&cf, optimize, arena);
|
||||
result = (PyObject*)PyAST_CompileObject(mod, filename,
|
||||
&cf, optimize, arena);
|
||||
PyArena_Free(arena);
|
||||
}
|
||||
goto finally;
|
||||
|
@ -670,13 +668,13 @@ builtin_compile(PyObject *self, PyObject *args, PyObject *kwds)
|
|||
if (str == NULL)
|
||||
goto error;
|
||||
|
||||
result = Py_CompileStringExFlags(str, filename, start[mode], &cf, optimize);
|
||||
result = Py_CompileStringObject(str, filename, start[mode], &cf, optimize);
|
||||
goto finally;
|
||||
|
||||
error:
|
||||
result = NULL;
|
||||
finally:
|
||||
Py_DECREF(filename_obj);
|
||||
Py_DECREF(filename);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue