mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Fix two crashers.
This commit is contained in:
parent
b2302ba977
commit
1d9a9eaa89
4 changed files with 11 additions and 44 deletions
|
@ -1245,11 +1245,14 @@ min_max(PyObject *args, PyObject *kwds, int op)
|
|||
"%s() got an unexpected keyword argument", name);
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(keyfunc);
|
||||
}
|
||||
|
||||
it = PyObject_GetIter(v);
|
||||
if (it == NULL)
|
||||
if (it == NULL) {
|
||||
Py_XDECREF(keyfunc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
maxitem = NULL; /* the result */
|
||||
maxval = NULL; /* the value associated with the result */
|
||||
|
@ -1298,6 +1301,7 @@ min_max(PyObject *args, PyObject *kwds, int op)
|
|||
else
|
||||
Py_DECREF(maxval);
|
||||
Py_DECREF(it);
|
||||
Py_XDECREF(keyfunc);
|
||||
return maxitem;
|
||||
|
||||
Fail_it_item_and_val:
|
||||
|
@ -1308,6 +1312,7 @@ Fail_it:
|
|||
Py_XDECREF(maxval);
|
||||
Py_XDECREF(maxitem);
|
||||
Py_DECREF(it);
|
||||
Py_XDECREF(keyfunc);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue