mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Fix some missing checks after PyTuple_New, PyList_New, PyDict_New
This commit is contained in:
parent
a5a0704942
commit
5c170fd4a9
7 changed files with 27 additions and 7 deletions
|
@ -1106,14 +1106,17 @@ set_mro_error(PyObject *to_merge, int *remain)
|
|||
char buf[1000];
|
||||
PyObject *k, *v;
|
||||
PyObject *set = PyDict_New();
|
||||
if (!set) return;
|
||||
|
||||
to_merge_size = PyList_GET_SIZE(to_merge);
|
||||
for (i = 0; i < to_merge_size; i++) {
|
||||
PyObject *L = PyList_GET_ITEM(to_merge, i);
|
||||
if (remain[i] < PyList_GET_SIZE(L)) {
|
||||
PyObject *c = PyList_GET_ITEM(L, remain[i]);
|
||||
if (PyDict_SetItem(set, c, Py_None) < 0)
|
||||
if (PyDict_SetItem(set, c, Py_None) < 0) {
|
||||
Py_DECREF(set);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
n = PyDict_Size(set);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue