Lines Matching refs:gbo

217     groupbyobject *gbo;
219 gbo = (groupbyobject *)type->tp_alloc(type, 0);
220 if (gbo == NULL)
222 gbo->tgtkey = NULL;
223 gbo->currkey = NULL;
224 gbo->currvalue = NULL;
225 gbo->keyfunc = keyfunc;
227 gbo->it = PyObject_GetIter(it);
228 if (gbo->it == NULL) {
229 Py_DECREF(gbo);
232 return (PyObject *)gbo;
236 groupby_dealloc(groupbyobject *gbo)
238 PyObject_GC_UnTrack(gbo);
239 Py_XDECREF(gbo->it);
240 Py_XDECREF(gbo->keyfunc);
241 Py_XDECREF(gbo->tgtkey);
242 Py_XDECREF(gbo->currkey);
243 Py_XDECREF(gbo->currvalue);
244 Py_TYPE(gbo)->tp_free(gbo);
248 groupby_traverse(groupbyobject *gbo, visitproc visit, void *arg)
250 Py_VISIT(gbo->it);
251 Py_VISIT(gbo->keyfunc);
252 Py_VISIT(gbo->tgtkey);
253 Py_VISIT(gbo->currkey);
254 Py_VISIT(gbo->currvalue);
259 groupby_step(groupbyobject *gbo)
263 newvalue = PyIter_Next(gbo->it);
267 if (gbo->keyfunc == Py_None) {
271 newkey = PyObject_CallOneArg(gbo->keyfunc, newvalue);
278 oldvalue = gbo->currvalue;
279 gbo->currvalue = newvalue;
280 Py_XSETREF(gbo->currkey, newkey);
286 groupby_next(groupbyobject *gbo)
290 gbo->currgrouper = NULL;
293 if (gbo->currkey == NULL)
295 else if (gbo->tgtkey == NULL)
300 rcmp = PyObject_RichCompareBool(gbo->tgtkey, gbo->currkey, Py_EQ);
307 if (groupby_step(gbo) < 0)
310 Py_INCREF(gbo->currkey);
311 Py_XSETREF(gbo->tgtkey, gbo->currkey);
313 grouper = _grouper_create(gbo, gbo->tgtkey);
317 r = PyTuple_Pack(2, gbo->currkey, grouper);
479 groupbyobject *gbo = (groupbyobject *)igo->parent;
483 if (gbo->currgrouper != igo)
485 if (gbo->currvalue == NULL) {
486 if (groupby_step(gbo) < 0)
490 assert(gbo->currkey != NULL);
491 rcmp = PyObject_RichCompareBool(igo->tgtkey, gbo->currkey, Py_EQ);
496 r = gbo->currvalue;
497 gbo->currvalue = NULL;
498 Py_CLEAR(gbo->currkey);