Mercurial > cpython-lru_cache-weakref
diff Python/importdl.c @ 30316:19611d101d23 legacy-trunk
Patch #794826: Add __file__ in dynamically loaded modules for multiple
interpreters. Fixes #698282. Will backport to 2.3.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Thu, 04 Sep 2003 18:45:59 +0000 |
| parents | db49ee76b7d0 |
| children | fd25030223b0 19319e70fc3e |
line wrap: on
line diff
--- a/Python/importdl.c Thu Sep 04 18:29:53 2003 +0000 +++ b/Python/importdl.c Thu Sep 04 18:45:59 2003 +0000 @@ -54,8 +54,6 @@ _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 @@ /* 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",
