File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3326,24 +3326,24 @@ static PyObject *
33263326imp_load_dynamic (PyObject * self , PyObject * args )
33273327{
33283328 char * name ;
3329+ PyObject * pathbytes ;
33293330 char * pathname ;
33303331 PyObject * fob = NULL ;
33313332 PyObject * m ;
33323333 FILE * fp = NULL ;
3333- if (!PyArg_ParseTuple (args , "ses|O:load_dynamic" ,
3334- & name ,
3335- Py_FileSystemDefaultEncoding , & pathname ,
3336- & fob ))
3334+ if (!PyArg_ParseTuple (args , "sO&|O:load_dynamic" ,
3335+ & name , PyUnicode_FSConverter , & pathbytes , & fob ))
33373336 return NULL ;
3337+ pathname = PyBytes_AS_STRING (pathbytes );
33383338 if (fob ) {
33393339 fp = get_file (pathname , fob , "r" );
33403340 if (fp == NULL ) {
3341- PyMem_Free ( pathname );
3341+ Py_DECREF ( pathbytes );
33423342 return NULL ;
33433343 }
33443344 }
33453345 m = _PyImport_LoadDynamicModule (name , pathname , fp );
3346- PyMem_Free ( pathname );
3346+ Py_DECREF ( pathbytes );
33473347 if (fp )
33483348 fclose (fp );
33493349 return m ;
You can’t perform that action at this time.
0 commit comments