Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 41179:1dcdbc25dea7 2.5
Inline PyImport_GetModulesReloading(). Backport from r54368.
| author | Collin Winter <collinw@gmail.com> |
|---|---|
| date | Tue, 13 Mar 2007 23:04:29 +0000 |
| parents | 66f265ac4ec4 |
| children | a3bf55a03f66 |
line wrap: on
line diff
--- a/Python/import.c Tue Mar 13 22:16:43 2007 +0000 +++ b/Python/import.c Tue Mar 13 23:04:29 2007 +0000 @@ -339,15 +339,6 @@ return Py_None; } -PyObject * -PyImport_GetModulesReloading(void) -{ - PyInterpreterState *interp = PyThreadState_Get()->interp; - if (interp->modules_reloading == NULL) - Py_FatalError("PyImport_GetModuleDict: no modules_reloading dictionary!"); - return interp->modules_reloading; -} - static void imp_modules_reloading_clear (void) { @@ -2420,7 +2411,8 @@ PyObject * PyImport_ReloadModule(PyObject *m) { - PyObject *modules_reloading = PyImport_GetModulesReloading(); + PyInterpreterState *interp = PyThreadState_Get()->interp; + PyObject *modules_reloading = interp->modules_reloading; PyObject *modules = PyImport_GetModuleDict(); PyObject *path = NULL, *loader = NULL, *existing_m = NULL; char *name, *subname; @@ -2428,6 +2420,12 @@ struct filedescr *fdp; FILE *fp = NULL; PyObject *newm; + + if (modules_reloading == NULL) { + Py_FatalError("PyImport_ReloadModule: " + "no modules_reloading dictionary!"); + return NULL; + } if (m == NULL || !PyModule_Check(m)) { PyErr_SetString(PyExc_TypeError,
