gh-118613: Fix error handling of _PyEval_GetFrameLocals
in ceval.c
(#118614)
This commit is contained in:
parent
1506d5adc4
commit
a8e5fed100
@ -2496,17 +2496,21 @@ _PyEval_GetFrameLocals(void)
|
|||||||
|
|
||||||
if (PyFrameLocalsProxy_Check(locals)) {
|
if (PyFrameLocalsProxy_Check(locals)) {
|
||||||
PyObject* ret = PyDict_New();
|
PyObject* ret = PyDict_New();
|
||||||
if (PyDict_Update(ret, locals)) {
|
if (ret == NULL) {
|
||||||
|
Py_DECREF(locals);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (PyDict_Update(ret, locals) < 0) {
|
||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
|
Py_DECREF(locals);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Py_DECREF(locals);
|
Py_DECREF(locals);
|
||||||
return ret;
|
return ret;
|
||||||
} else if (PyMapping_Check(locals)) {
|
|
||||||
return locals;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
assert(PyMapping_Check(locals));
|
||||||
|
return locals;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user