Skip to content

Commit

Permalink
Avoid 'for' loop initial declarations for improved compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
bsteffensmeier committed Dec 9, 2022
1 parent c744486 commit 056ce99
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/c/Objects/pyjtype.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,8 @@ static int merge_mro(PyTypeObject* base, PyObject* mro_list)
return -1;
}
Py_ssize_t n = PyTuple_Size(base_mro);
for (Py_ssize_t i = 0; i < n; i++) {
Py_ssize_t i = 0;
for (i = 0; i < n; i++) {
PyObject *next = PyTuple_GetItem(base_mro, i);
int contains = PySequence_Contains(mro_list, next);
if (contains < 0) {
Expand Down Expand Up @@ -508,7 +509,8 @@ static PyObject* pyjtype_mro(PyObject* self, PyObject* unused)

PyObject *bases = type->tp_bases;
Py_ssize_t n = PyTuple_Size(bases);
for (Py_ssize_t i = 0; i < n; i++) {
Py_ssize_t i = 0;
for (i = 0; i < n; i++) {
PyObject *base = PyTuple_GetItem(bases, i);
int contains = PySequence_Contains(mro_list, base);
if (contains < 0) {
Expand Down

0 comments on commit 056ce99

Please sign in to comment.