We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 336c367 commit 9cbe1a6Copy full SHA for 9cbe1a6
Modules/itertoolsmodule.c
@@ -545,16 +545,18 @@ groupby_next(PyObject *op)
545
break;
546
else {
547
int rcmp;
548
-
+ PyObject *tgtkey = gbo->tgtkey;
549
+ PyObject *currkey = gbo->currkey;
550
+
551
/* Hold strong references during comparison to prevent re-entrant __eq__
552
from advancing the iterator and invalidating borrowed references. */
- Py_INCREF(gbo -> tgtkey);
- Py_INCREF(gbo -> currkey);
553
+ Py_INCREF(tgtkey);
554
+ Py_INCREF(currkey);
555
556
rcmp = PyObject_RichCompareBool(tgtkey, currkey, Py_EQ);
557
- Py_DECREF(gbo -> tgtkey);
- Py_DECREF(gbo -> currkey);
558
+ Py_DECREF(tgtkey);
559
+ Py_DECREF(currkey);
560
561
if (rcmp == -1)
562
return NULL;
0 commit comments