Fix recursive lazy imports and error path in bytecodes.c

This commit is contained in:
Pablo Galindo Salgado 2025-09-23 19:20:36 +01:00 committed by Dino Viehland
parent f9880bfd5f
commit f3f5795e31
6 changed files with 18 additions and 6 deletions

View file

@ -1835,7 +1835,7 @@ dummy_func(
PyObject *res_o = PyStackRef_AsPyObjectBorrow(*res);
if (PyLazyImport_CheckExact(res_o)) {
PyObject *l_v = _PyImport_LoadLazyImportTstate(tstate, res_o);
if (PyDict_SetItem(GLOBALS(), name, l_v) < 0) {
if (l_v != NULL && PyDict_SetItem(GLOBALS(), name, l_v) < 0) {
JUMP_TO_LABEL(error);
}
res_o = l_v;