File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -596,7 +596,7 @@ def testUnencodable(self):
596596 z .writestr (zinfo , test_src )
597597 z .close ()
598598 try :
599- zipimport .zipimporter (filename )
599+ zipimport .zipimporter (filename ). load_module ( TESTMOD )
600600 finally :
601601 os .remove (filename )
602602
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ Release date: TBA
1010Core and Builtins
1111-----------------
1212
13+ - Issue #25758: Prevents zipimport from unnecessarily encoding a filename
14+ (patch by Eryk Sun)
15+
1316- Issue #27812: Properly clear out a generator's frame's backreference to the
1417 generator to prevent crashes in frame.clear().
1518
Original file line number Diff line number Diff line change @@ -1362,22 +1362,16 @@ normalize_line_endings(PyObject *source)
13621362static PyObject *
13631363compile_source (PyObject * pathname , PyObject * source )
13641364{
1365- PyObject * code , * fixed_source , * pathbytes ;
1366-
1367- pathbytes = PyUnicode_EncodeFSDefault (pathname );
1368- if (pathbytes == NULL )
1369- return NULL ;
1365+ PyObject * code , * fixed_source ;
13701366
13711367 fixed_source = normalize_line_endings (source );
13721368 if (fixed_source == NULL ) {
1373- Py_DECREF (pathbytes );
13741369 return NULL ;
13751370 }
13761371
1377- code = Py_CompileString (PyBytes_AsString (fixed_source ),
1378- PyBytes_AsString (pathbytes ),
1379- Py_file_input );
1380- Py_DECREF (pathbytes );
1372+ code = Py_CompileStringObject (PyBytes_AsString (fixed_source ),
1373+ pathname , Py_file_input , NULL , 1 );
1374+
13811375 Py_DECREF (fixed_source );
13821376 return code ;
13831377}
You can’t perform that action at this time.
0 commit comments