Skip to content

Commit fef6412

Browse files
TheSkyCpicnixz
andauthored
Update Modules/itertoolsmodule.c
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
1 parent 895b685 commit fef6412

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Modules/itertoolsmodule.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -682,11 +682,8 @@ _grouper_next(PyObject *op)
682682
mutating gbo->currkey while we are comparing them.
683683
Take local snapshots and hold strong references so INCREF/DECREF
684684
apply to the same objects even under re-entrancy. */
685-
PyObject *tgtkey = igo->tgtkey;
686-
PyObject *currkey = gbo->currkey;
687-
688-
Py_INCREF(tgtkey);
689-
Py_INCREF(currkey);
685+
PyObject *tgtkey = Py_NewRef(igo->tgtkey);
686+
PyObject *currkey = Py_NewRef(gbo->currkey);
690687
rcmp = PyObject_RichCompareBool(tgtkey, currkey, Py_EQ);
691688
Py_DECREF(tgtkey);
692689
Py_DECREF(currkey);

0 commit comments

Comments
 (0)