File tree Expand file tree Collapse file tree 1 file changed +2
-8
lines changed
Expand file tree Collapse file tree 1 file changed +2
-8
lines changed Original file line number Diff line number Diff line change @@ -678,14 +678,8 @@ _grouper_next(PyObject *op)
678678 }
679679
680680 assert (gbo -> currkey != NULL );
681- /* A user-defined __eq__ can re-enter groupby (via the parent iterator)
682- and call groupby_step(), which frees gbo->currkey via Py_XSETREF while
683- we are still comparing it. Take local snapshots with strong references
684- so INCREF/DECREF apply to the same objects even under re-entrancy. */
685- PyObject * tgtkey = igo -> tgtkey ;
686- PyObject * currkey = gbo -> currkey ;
687- Py_INCREF (tgtkey );
688- Py_INCREF (currkey );
681+ PyObject * tgtkey = Py_NewRef (igo -> tgtkey );
682+ PyObject * currkey = Py_NewRef (gbo -> currkey );
689683 rcmp = PyObject_RichCompareBool (tgtkey , currkey , Py_EQ );
690684 Py_DECREF (tgtkey );
691685 Py_DECREF (currkey );
You can’t perform that action at this time.
0 commit comments