Fix #14600. Correct reference handling and naming of ImportError convenience function

This commit is contained in:
Brian Curtin 2012-04-17 16:57:09 -05:00
parent fba807ac44
commit 09b86d1196
5 changed files with 37 additions and 59 deletions

View file

@ -2460,7 +2460,8 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals,
PyObject *msg = PyUnicode_FromFormat("import of %R halted; "
"None in sys.modules", abs_name);
if (msg != NULL) {
PyErr_SetFromImportErrorWithName(msg, abs_name);
PyErr_SetImportError(msg, abs_name, NULL);
Py_DECREF(msg);
}
mod = NULL;
goto error_with_unlock;