diff options
Diffstat (limited to 'Python/importdl.c')
-rw-r--r-- | Python/importdl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/importdl.c b/Python/importdl.c index 9c325e4..7978c48 100644 --- a/Python/importdl.c +++ b/Python/importdl.c @@ -62,7 +62,9 @@ _PyImport_LoadDynamicModule(char *name, char *pathname, FILE *fp) return NULL; } /* Remember the filename as the __file__ attribute */ - if (PyModule_AddStringConstant(m, "__file__", pathname) < 0) + PyObject *path; + path = PyUnicode_DecodeFSDefault(pathname); + if (PyModule_AddObject(m, "__file__", path) < 0) PyErr_Clear(); /* Not important enough to report */ if (_PyImport_FixupExtension(name, pathname) == NULL) |