mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
fix error path in _PyImport_LazyImportModuleLevelObject
This commit is contained in:
parent
74f35c42cb
commit
301481631f
1 changed files with 4 additions and 1 deletions
|
|
@ -4371,7 +4371,9 @@ _PyImport_LazyImportModuleLevelObject(PyThreadState *tstate,
|
||||||
Py_DECREF(filter);
|
Py_DECREF(filter);
|
||||||
Py_DECREF(abs_name);
|
Py_DECREF(abs_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else if (modname == NULL) {
|
}
|
||||||
|
if (modname == NULL) {
|
||||||
|
assert(!PyErr_Occurred());
|
||||||
modname = Py_NewRef(Py_None);
|
modname = Py_NewRef(Py_None);
|
||||||
}
|
}
|
||||||
PyObject *args[] = {modname, name, fromlist};
|
PyObject *args[] = {modname, name, fromlist};
|
||||||
|
|
@ -4405,6 +4407,7 @@ _PyImport_LazyImportModuleLevelObject(PyThreadState *tstate,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// here, 'filter' is either NULL or is equivalent to a borrowed reference
|
||||||
PyObject *res = _PyLazyImport_New(builtins, abs_name, fromlist);
|
PyObject *res = _PyLazyImport_New(builtins, abs_name, fromlist);
|
||||||
if (res == NULL) {
|
if (res == NULL) {
|
||||||
Py_DECREF(abs_name);
|
Py_DECREF(abs_name);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue