diff options
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r-- | Python/_warnings.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index ba00485..f6688b0 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -38,7 +38,6 @@ static PyObject * get_warnings_attr(const char *attr, int try_import) { static PyObject *warnings_str = NULL; - PyObject *all_modules; PyObject *warnings_module, *obj; if (warnings_str == NULL) { @@ -58,13 +57,9 @@ get_warnings_attr(const char *attr, int try_import) } } else { - all_modules = PyImport_GetModuleDict(); - - warnings_module = PyDict_GetItem(all_modules, warnings_str); + warnings_module = PyImport_GetModule(warnings_str); if (warnings_module == NULL) return NULL; - - Py_INCREF(warnings_module); } if (!PyObject_HasAttrString(warnings_module, attr)) { |