Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
review comments
  • Loading branch information
eendebakpt committed Mar 11, 2025
commit 560bc59322fe92de2e9acf7cc123a78420ac626f
15 changes: 3 additions & 12 deletions Modules/itertoolsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,9 @@ batched_next(batchedobject *bo)
PyObject *item;
PyObject *result;

#ifdef Py_GIL_DISABLED
if (it == NULL) {
return NULL;
}
#else
if (n < 0) {
Comment thread
kumaraditya303 marked this conversation as resolved.
return NULL;
}
#endif
result = PyTuple_New(n);
if (result == NULL) {
return NULL;
Expand All @@ -219,9 +213,8 @@ batched_next(batchedobject *bo)
if (PyErr_Occurred()) {
if (!PyErr_ExceptionMatches(PyExc_StopIteration)) {
/* Input raised an exception other than StopIteration */
#ifdef Py_GIL_DISABLED
FT_ATOMIC_STORE_SSIZE_RELAXED(bo->batch_size, -1);
#else
#ifndef Py_GIL_DISABLED
Py_CLEAR(bo->it);
Comment thread
kumaraditya303 marked this conversation as resolved.
#endif
Py_DECREF(result);
Expand All @@ -230,18 +223,16 @@ batched_next(batchedobject *bo)
PyErr_Clear();
}
if (i == 0) {
#ifdef Py_GIL_DISABLED
FT_ATOMIC_STORE_SSIZE_RELAXED(bo->batch_size, -1);
#else
#ifndef Py_GIL_DISABLED
Py_CLEAR(bo->it);
#endif
Py_DECREF(result);
return NULL;
}
if (bo->strict) {
#ifdef Py_GIL_DISABLED
FT_ATOMIC_STORE_SSIZE_RELAXED(bo->batch_size, -1);
#else
#ifndef Py_GIL_DISABLED
Py_CLEAR(bo->it);
#endif
Py_DECREF(result);
Expand Down
Loading