summaryrefslogtreecommitdiffstats
path: root/Python/import.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-05-30 14:45:22 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-05-30 14:45:22 (GMT)
commitfa494fd88384acc52cf9292d0c89e2961c8f747f (patch)
treea30958b83189caf872f34e7b94a1aeeef28ed3a9 /Python/import.c
parent50451eb91232b0e90c677419db19ed7b33a698a9 (diff)
downloadcpython-fa494fd88384acc52cf9292d0c89e2961c8f747f.zip
cpython-fa494fd88384acc52cf9292d0c89e2961c8f747f.tar.gz
cpython-fa494fd88384acc52cf9292d0c89e2961c8f747f.tar.bz2
Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains() to check for and handle errors correctly.
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c
index 34f4fd5..4f0765a 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1416,6 +1416,7 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals,
PyObject *globals = NULL;
PyObject *fromlist = NULL;
PyInterpreterState *interp = PyThreadState_GET()->interp;
+ int has_from;
/* Make sure to use default values so as to not have
PyObject_CallMethodObjArgs() truncate the parameter list because of a
@@ -1646,7 +1647,10 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *given_globals,
}
/* From now on we don't hold the import lock anymore. */
- if (PyObject_Not(fromlist)) {
+ has_from = PyObject_IsTrue(fromlist);
+ if (has_from < 0)
+ goto error;
+ if (!has_from) {
if (level == 0 || PyUnicode_GET_LENGTH(name) > 0) {
PyObject *front = NULL;
PyObject *partition = NULL;