Skip to content

Commit 0f9cea1

Browse files
pythongh-101892 : Updated Cython/objects/iterobject.c Line 217
1 parent 188e388 commit 0f9cea1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Objects/iterobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,14 @@ calliter_iternext(calliterobject *it)
214214
}
215215

216216
result = _PyObject_CallNoArgs(it->it_callable);
217-
if (result != NULL && it->it_callable != NULL) {
217+
if (result != NULL && it->it_sentinel != NULL){
218218
int ok;
219219

220220
ok = PyObject_RichCompareBool(it->it_sentinel, result, Py_EQ);
221221
if (ok == 0) {
222222
return result; /* Common case, fast path */
223223
}
224224

225-
Py_DECREF(result);
226225
if (ok > 0) {
227226
Py_CLEAR(it->it_callable);
228227
Py_CLEAR(it->it_sentinel);
@@ -233,6 +232,7 @@ calliter_iternext(calliterobject *it)
233232
Py_CLEAR(it->it_callable);
234233
Py_CLEAR(it->it_sentinel);
235234
}
235+
Py_XDECREF(result);
236236
return NULL;
237237
}
238238

0 commit comments

Comments
 (0)