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 1ea51c0 commit 336c367Copy full SHA for 336c367
1 file changed
Modules/itertoolsmodule.c
@@ -545,20 +545,16 @@ 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. */
553
554
555
- Py_INCREF(tgtkey);
556
- Py_INCREF(currkey);
+ Py_INCREF(gbo -> tgtkey);
+ Py_INCREF(gbo -> currkey);
557
558
rcmp = PyObject_RichCompareBool(tgtkey, currkey, Py_EQ);
559
560
- Py_DECREF(tgtkey);
561
- Py_DECREF(currkey);
+ Py_DECREF(gbo -> tgtkey);
+ Py_DECREF(gbo -> currkey);
562
563
if (rcmp == -1)
564
return NULL;
0 commit comments