summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2016-09-10 00:33:37 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2016-09-10 00:33:37 (GMT)
commitff70fc220653d8999d69bd3f3b986a07afc81b64 (patch)
treeec3a8b95c09b001e3446304a7342767475ad5eaa /Modules
parent1319236167041f01c4efd4f7cc1400d2e4a18275 (diff)
parent8dcc48ee3b6447cd63038e63ee11de36f6d85a68 (diff)
downloadcpython-ff70fc220653d8999d69bd3f3b986a07afc81b64.zip
cpython-ff70fc220653d8999d69bd3f3b986a07afc81b64.tar.gz
cpython-ff70fc220653d8999d69bd3f3b986a07afc81b64.tar.bz2
Issue #25758: Prevents zipimport from unnecessarily encoding a filename (patch by Eryk Sun)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/zipimport.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
index 6d5c68a..92a82e6 100644
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -1362,22 +1362,16 @@ 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, 1);
+
Py_DECREF(fixed_source);
return code;
}