mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Inline PyImport_GetModulesReloading().
This commit is contained in:
parent
4aef7275cb
commit
47c52a8b60
1 changed files with 8 additions and 11 deletions
|
@ -340,16 +340,6 @@ imp_release_lock(PyObject *self, PyObject *noargs)
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
|
||||||
PyImport_GetModulesReloading(void)
|
|
||||||
{
|
|
||||||
PyInterpreterState *interp = PyThreadState_Get()->interp;
|
|
||||||
if (interp->modules_reloading == NULL)
|
|
||||||
Py_FatalError("PyImport_GetModulesReloading: "
|
|
||||||
"no modules_reloading dictionary!");
|
|
||||||
return interp->modules_reloading;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
imp_modules_reloading_clear(void)
|
imp_modules_reloading_clear(void)
|
||||||
{
|
{
|
||||||
|
@ -2420,7 +2410,8 @@ import_submodule(PyObject *mod, char *subname, char *fullname)
|
||||||
PyObject *
|
PyObject *
|
||||||
PyImport_ReloadModule(PyObject *m)
|
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 *modules = PyImport_GetModuleDict();
|
||||||
PyObject *path = NULL, *loader = NULL, *existing_m = NULL;
|
PyObject *path = NULL, *loader = NULL, *existing_m = NULL;
|
||||||
char *name, *subname;
|
char *name, *subname;
|
||||||
|
@ -2428,6 +2419,12 @@ PyImport_ReloadModule(PyObject *m)
|
||||||
struct filedescr *fdp;
|
struct filedescr *fdp;
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
PyObject *newm;
|
PyObject *newm;
|
||||||
|
|
||||||
|
if (modules_reloading == NULL) {
|
||||||
|
Py_FatalError("PyImport_ReloadModule: "
|
||||||
|
"no modules_reloading dictionary!");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (m == NULL || !PyModule_Check(m)) {
|
if (m == NULL || !PyModule_Check(m)) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue