summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2017-09-15 22:35:20 (GMT)
committerGitHub <noreply@github.com>2017-09-15 22:35:20 (GMT)
commit3f9eee6eb4b25fe1926eaa5f00e02344b126f54d (patch)
treec749747e0b4ce492d05c34ad5578b81128be1156 /Python/ceval.c
parente82c034496512139e9ea3f68ceda86c04bc7baab (diff)
downloadcpython-3f9eee6eb4b25fe1926eaa5f00e02344b126f54d.zip
cpython-3f9eee6eb4b25fe1926eaa5f00e02344b126f54d.tar.gz
cpython-3f9eee6eb4b25fe1926eaa5f00e02344b126f54d.tar.bz2
bpo-28411: Support other mappings in PyInterpreterState.modules. (#3593)
The concrete PyDict_* API is used to interact with PyInterpreterState.modules in a number of places. This isn't compatible with all dict subclasses, nor with other Mapping implementations. This patch switches the concrete API usage to the corresponding abstract API calls. We also add a PyImport_GetModule() function (and some other helpers) to reduce a bunch of code duplication.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 5b810f2..8cc5094 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4935,13 +4935,12 @@ import_from(PyObject *v, PyObject *name)
Py_DECREF(pkgname);
return NULL;
}
- x = PyDict_GetItem(PyImport_GetModuleDict(), fullmodname);
+ x = PyImport_GetModule(fullmodname);
Py_DECREF(fullmodname);
if (x == NULL) {
goto error;
}
Py_DECREF(pkgname);
- Py_INCREF(x);
return x;
error:
pkgpath = PyModule_GetFilenameObject(v);