mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue #24115: Update uses of PyObject_IsTrue(), PyObject_Not(),
PyObject_IsInstance(), PyObject_RichCompareBool() and _PyDict_Contains() to check for and handle errors correctly.
This commit is contained in:
parent
50451eb912
commit
fa494fd883
10 changed files with 83 additions and 36 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue