Skip to content

Commit fed7db7

Browse files
Move rcmp declaration and clarify re-entrancy comment
1 parent 2cac26b commit fed7db7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Modules/itertoolsmodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ groupby_next(PyObject *op)
544544
else if (gbo->tgtkey == NULL)
545545
break;
546546
else {
547+
int rcmp;
547548

548549
/* A user-defined __eq__ can re-enter groupby and advance the iterator,
549550
mutating gbo->tgtkey / gbo->currkey while we are comparing them.
@@ -555,7 +556,7 @@ groupby_next(PyObject *op)
555556
Py_INCREF(tgtkey);
556557
Py_INCREF(currkey);
557558

558-
int rcmp = PyObject_RichCompareBool(tgtkey, currkey, Py_EQ);
559+
rcmp = PyObject_RichCompareBool(tgtkey, currkey, Py_EQ);
559560

560561
Py_DECREF(tgtkey);
561562
Py_DECREF(currkey);

0 commit comments

Comments
 (0)