diff options
| author | Martin v. Löwis <martin@v.loewis.de> | 2003-09-04 18:46:39 (GMT) |
|---|---|---|
| committer | Martin v. Löwis <martin@v.loewis.de> | 2003-09-04 18:46:39 (GMT) |
| commit | abb296712fe7ad6b4b39eacf68291beda91d4814 (patch) | |
| tree | 5af0a4a9793f2b17feb5129cf26b7ce7f6544269 /Python | |
| parent | 5a3fd229206fb094d590f20da81a205b6581ae70 (diff) | |
| download | cpython-abb296712fe7ad6b4b39eacf68291beda91d4814.zip cpython-abb296712fe7ad6b4b39eacf68291beda91d4814.tar.gz cpython-abb296712fe7ad6b4b39eacf68291beda91d4814.tar.bz2 | |
Patch #794826: Add __file__ in dynamically loaded modules for multiple
interpreters. Fixes #698282.
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/importdl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/importdl.c b/Python/importdl.c index c2400f7..9c325e4 100644 --- a/Python/importdl.c +++ b/Python/importdl.c @@ -54,8 +54,6 @@ _PyImport_LoadDynamicModule(char *name, char *pathname, FILE *fp) _Py_PackageContext = oldcontext; if (PyErr_Occurred()) return NULL; - if (_PyImport_FixupExtension(name, pathname) == NULL) - return NULL; m = PyDict_GetItemString(PyImport_GetModuleDict(), name); if (m == NULL) { @@ -66,6 +64,9 @@ _PyImport_LoadDynamicModule(char *name, char *pathname, FILE *fp) /* Remember the filename as the __file__ attribute */ if (PyModule_AddStringConstant(m, "__file__", pathname) < 0) PyErr_Clear(); /* Not important enough to report */ + + if (_PyImport_FixupExtension(name, pathname) == NULL) + return NULL; if (Py_VerboseFlag) PySys_WriteStderr( "import %s # dynamically loaded from %s\n", |
