summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorRobert Rouhani <robert.rouhani@gmail.com>2020-05-06 00:49:29 (GMT)
committerGitHub <noreply@github.com>2020-05-06 00:49:29 (GMT)
commitd64fd617e02346ecbcba9559f227936e08e89602 (patch)
treede3abee1691c0e80f1bf24cd65f3db13582200c6 /Python
parent8ddf91543890e38c76aa0029482c6f5f5c444837 (diff)
downloadcpython-d64fd617e02346ecbcba9559f227936e08e89602.zip
cpython-d64fd617e02346ecbcba9559f227936e08e89602.tar.gz
cpython-d64fd617e02346ecbcba9559f227936e08e89602.tar.bz2
[3.7] bpo-40417: Fix deprecation warning in PyImport_ReloadModule (GH-19750) (GH-19935)
Use importlib instead of imp. Automerge-Triggered-By: @brettcannon. (cherry picked from commit f40bd46) Co-authored-by: Robert Rouhani robert.rouhani@gmail.com
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/Python/import.c b/Python/import.c
index edc5924..6d014cf 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1858,23 +1858,23 @@ PyImport_ImportModuleLevel(const char *name, PyObject *globals, PyObject *locals
PyObject *
PyImport_ReloadModule(PyObject *m)
{
- _Py_IDENTIFIER(imp);
+ _Py_IDENTIFIER(importlib);
_Py_IDENTIFIER(reload);
PyObject *reloaded_module = NULL;
- PyObject *imp = _PyImport_GetModuleId(&PyId_imp);
- if (imp == NULL) {
+ PyObject *importlib = _PyImport_GetModuleId(&PyId_importlib);
+ if (importlib == NULL) {
if (PyErr_Occurred()) {
return NULL;
}
- imp = PyImport_ImportModule("imp");
- if (imp == NULL) {
+ importlib = PyImport_ImportModule("importlib");
+ if (importlib == NULL) {
return NULL;
}
}
- reloaded_module = _PyObject_CallMethodIdObjArgs(imp, &PyId_reload, m, NULL);
- Py_DECREF(imp);
+ reloaded_module = _PyObject_CallMethodIdObjArgs(importlib, &PyId_reload, m, NULL);
+ Py_DECREF(importlib);
return reloaded_module;
}