Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
25 changes: 14 additions & 11 deletions Modules/itertoolsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -3531,23 +3531,26 @@ count_traverse(PyObject *op, visitproc visit, void *arg)
static PyObject *
count_nextlong(countobject *lz)
{
PyObject *long_cnt;
PyObject *stepped_up;

long_cnt = lz->long_cnt;
if (long_cnt == NULL) {
if (lz->long_cnt == NULL) {
/* Switch to slow_mode */
long_cnt = PyLong_FromSsize_t(PY_SSIZE_T_MAX);
if (long_cnt == NULL)
lz->long_cnt = PyLong_FromSsize_t(PY_SSIZE_T_MAX);
if (lz->long_cnt == NULL) {
return NULL;
}
}
assert(lz->cnt == PY_SSIZE_T_MAX && long_cnt != NULL);
assert(lz->cnt == PY_SSIZE_T_MAX && lz->long_cnt != NULL);

// We hold one reference to "result" (a.k.a. the old value of
// lz->long_cnt); we'll either return it or keep it in lz->long_cnt.
PyObject *result = lz->long_cnt;

stepped_up = PyNumber_Add(long_cnt, lz->long_step);
if (stepped_up == NULL)
PyObject *stepped_up = PyNumber_Add(result, lz->long_step);
if (stepped_up == NULL) {
return NULL;
}
lz->long_cnt = stepped_up;
return long_cnt;

return result;
}

static PyObject *
Expand Down
10 changes: 6 additions & 4 deletions Objects/enumobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,16 @@
static inline PyObject *
increment_longindex_lock_held(enumobject *en)
{
PyObject *next_index = en->en_longindex;
if (next_index == NULL) {
next_index = PyLong_FromSsize_t(PY_SSIZE_T_MAX);
if (next_index == NULL) {
if (en->en_longindex == NULL) {
en->en_longindex = PyLong_FromSsize_t(PY_SSIZE_T_MAX);
if (en->en_longindex == NULL) {
return NULL;
}
}
assert(next_index != NULL);

Check warning on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64)

'!=': 'int' differs in levels of indirection from 'void *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (x64)

'next_index': undeclared identifier [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check warning on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64)

'!=': 'int' differs in levels of indirection from 'void *' [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (x64)

'next_index': undeclared identifier [D:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Hypothesis tests on Ubuntu

‘next_index’ undeclared (first use in this function)

Check warning on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (arm64)

'!=': 'int' differs in levels of indirection from 'void *' [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Windows / Build and test (arm64)

'next_index': undeclared identifier [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04)

‘next_index’ undeclared (first use in this function)

Check failure on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04)

‘next_index’ undeclared (first use in this function)

Check failure on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu / build and test (ubuntu-24.04-arm)

‘next_index’ undeclared (first use in this function)

Check failure on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (free-threading) / build and test (ubuntu-24.04-arm)

‘next_index’ undeclared (first use in this function)

Check failure on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Ubuntu (bolt) / build and test (ubuntu-24.04)

‘next_index’ undeclared (first use in this function)

Check warning on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (arm64)

'!=': 'int' differs in levels of indirection from 'void *' [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]

Check failure on line 187 in Objects/enumobject.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / Build and test (arm64)

'next_index': undeclared identifier [C:\a\cpython\cpython\PCbuild\_freeze_module.vcxproj]
// We hold one reference to "next_index" (a.k.a. the old value of
// en->en_longindex); we'll either return it or keep it in en->en_longindex
PyObject *next_index = en->en_longindex;
PyObject *stepped_up = PyNumber_Add(next_index, en->one);
if (stepped_up == NULL) {
return NULL;
Expand Down
4 changes: 3 additions & 1 deletion Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -4270,7 +4270,9 @@ listiter_reduce_general(void *_it, int forward)
}
/* empty iterator, create an empty list */
list = PyList_New(0);
if (list == NULL)
if (list == NULL) {
Py_DECREF(iter);
return NULL;
}
return Py_BuildValue("N(N)", iter, list);
}
Loading