We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 188e388 commit 0f9cea1Copy full SHA for 0f9cea1
Objects/iterobject.c
@@ -214,15 +214,14 @@ calliter_iternext(calliterobject *it)
214
}
215
216
result = _PyObject_CallNoArgs(it->it_callable);
217
- if (result != NULL && it->it_callable != NULL) {
+ if (result != NULL && it->it_sentinel != NULL){
218
int ok;
219
220
ok = PyObject_RichCompareBool(it->it_sentinel, result, Py_EQ);
221
if (ok == 0) {
222
return result; /* Common case, fast path */
223
224
225
- Py_DECREF(result);
226
if (ok > 0) {
227
Py_CLEAR(it->it_callable);
228
Py_CLEAR(it->it_sentinel);
@@ -233,6 +232,7 @@ calliter_iternext(calliterobject *it)
233
232
234
235
+ Py_XDECREF(result);
236
return NULL;
237
238
0 commit comments