File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -167,23 +167,22 @@ batched_next(batchedobject *bo)
167
167
168
168
null_item :
169
169
if (PyErr_Occurred ()) {
170
- if (PyErr_ExceptionMatches (PyExc_StopIteration )) {
171
- PyErr_Clear ();
172
- } else {
173
- /* input raised an exception other than StopIteration */
170
+ if (!PyErr_ExceptionMatches (PyExc_StopIteration )) {
171
+ /* Input raised an exception other than StopIteration */
174
172
Py_CLEAR (bo -> it );
175
173
Py_DECREF (result );
176
174
return NULL ;
177
175
}
176
+ PyErr_Clear ();
178
177
}
179
178
if (i == 0 ) {
180
179
Py_CLEAR (bo -> it );
181
180
Py_DECREF (result );
182
181
return NULL ;
183
182
}
184
- PyObject * short_list = PyList_GetSlice ( result , 0 , i );
185
- Py_DECREF (result );
186
- return short_list ;
183
+ /* Elements in result[i:] are still NULL */
184
+ Py_SET_SIZE (result , i );
185
+ return result ;
187
186
}
188
187
189
188
static PyTypeObject batched_type = {
You can’t perform that action at this time.
0 commit comments