diff --git a/Modules/zipimport.c b/Modules/zipimport.c index 8fe919539fdfffd7b1e13be5002c443cfdac4f8e..80822b66b3b80d98effd0cb303fca8fba75d2f7b 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -1275,22 +1275,18 @@ normalize_line_endings(PyObject *source) static PyObject * compile_source(PyObject *pathname, PyObject *source) { - PyObject *code, *fixed_source, *pathbytes; - - pathbytes = PyUnicode_EncodeFSDefault(pathname); - if (pathbytes == NULL) - return NULL; + PyObject *code, *fixed_source; fixed_source = normalize_line_endings(source); if (fixed_source == NULL) { - Py_DECREF(pathbytes); return NULL; } - code = Py_CompileString(PyBytes_AsString(fixed_source), - PyBytes_AsString(pathbytes), - Py_file_input); - Py_DECREF(pathbytes); + code = Py_CompileStringObject(PyBytes_AsString(fixed_source), + pathname, + Py_file_input, + NULL, /* No flags */ + -1); /* Use default optimize value */ Py_DECREF(fixed_source); return code; }