Kaydet (Commit) a7b0c121 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

PyList_Append() can fail

üst 5781f32b
...@@ -745,8 +745,10 @@ cycle_next(cycleobject *lz) ...@@ -745,8 +745,10 @@ cycle_next(cycleobject *lz)
while (1) { while (1) {
item = PyIter_Next(lz->it); item = PyIter_Next(lz->it);
if (item != NULL) { if (item != NULL) {
if (!lz->firstpass) if (!lz->firstpass && PyList_Append(lz->saved, item)) {
PyList_Append(lz->saved, item); Py_DECREF(item);
return NULL;
}
return item; return item;
} }
if (PyErr_Occurred()) { if (PyErr_Occurred()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment