python/dist/src/Modules itertoolsmodule.c, 1.35, 1.36

Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2652/Modules Modified Files: itertoolsmodule.c Log Message: * Increase test coverage. * Have groupby() be careful about decreffing structure members. Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- itertoolsmodule.c 1 Sep 2004 07:02:43 -0000 1.35 +++ itertoolsmodule.c 28 Sep 2004 04:45:27 -0000 1.36 @@ -75,7 +75,7 @@ static PyObject * groupby_next(groupbyobject *gbo) { - PyObject *newvalue, *newkey, *r, *grouper; + PyObject *newvalue, *newkey, *r, *grouper, *tmp; /* skip to next iteration group */ for (;;) { @@ -110,15 +110,19 @@ } } - Py_XDECREF(gbo->currkey); + tmp = gbo->currkey; gbo->currkey = newkey; - Py_XDECREF(gbo->currvalue); + Py_XDECREF(tmp); + + tmp = gbo->currvalue; gbo->currvalue = newvalue; + Py_XDECREF(tmp); } - Py_XDECREF(gbo->tgtkey); - gbo->tgtkey = gbo->currkey; Py_INCREF(gbo->currkey); + tmp = gbo->tgtkey; + gbo->tgtkey = gbo->currkey; + Py_XDECREF(tmp); grouper = _grouper_create(gbo, gbo->tgtkey); if (grouper == NULL)
participants (1)
-
rhettingerīŧ users.sourceforge.net