summaryrefslogtreecommitdiff
path: root/Python/import.c
diff options
context:
space:
mode:
authorBrian Curtin <brian@python.org>2012-04-17 16:57:09 -0500
committerBrian Curtin <brian@python.org>2012-04-17 16:57:09 -0500
commit5d8520121e1ea38bcfe37258449a946ee328cac1 (patch)
tree4cdf797354f42b885f54f693e3ed397821842220 /Python/import.c
parent5e1e248e4f7b23cd3fccc1981b448e0d5d7a3b49 (diff)
downloadcpython-5d8520121e1ea38bcfe37258449a946ee328cac1.tar.gz
Fix #14600. Correct reference handling and naming of ImportError convenience function
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c
index 584f30eb38..f3de7d8262 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -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;