• Home
  • Raw
  • Download

Lines Matching refs:lz

141 groupby_reduce(groupbyobject *lz)  in groupby_reduce()  argument
147 if (lz->tgtkey && lz->currkey && lz->currvalue) in groupby_reduce()
148 value = Py_BuildValue("O(OO)(OOO)", Py_TYPE(lz), in groupby_reduce()
149 lz->it, lz->keyfunc, lz->currkey, lz->currvalue, lz->tgtkey); in groupby_reduce()
151 value = Py_BuildValue("O(OO)", Py_TYPE(lz), in groupby_reduce()
152 lz->it, lz->keyfunc); in groupby_reduce()
160 groupby_setstate(groupbyobject *lz, PyObject *state) in groupby_setstate() argument
171 Py_XSETREF(lz->currkey, currkey); in groupby_setstate()
173 Py_XSETREF(lz->currvalue, currvalue); in groupby_setstate()
175 Py_XSETREF(lz->tgtkey, tgtkey); in groupby_setstate()
323 _grouper_reduce(_grouperobject *lz) in _grouper_reduce() argument
325 if (((groupbyobject *)lz->parent)->currgrouper != lz) { in _grouper_reduce()
328 return Py_BuildValue("O(OO)", Py_TYPE(lz), lz->parent, lz->tgtkey); in _grouper_reduce()
892 cycleobject *lz; in cycle_new() local
912 lz = (cycleobject *)type->tp_alloc(type, 0); in cycle_new()
913 if (lz == NULL) { in cycle_new()
918 lz->it = it; in cycle_new()
919 lz->saved = saved; in cycle_new()
920 lz->index = 0; in cycle_new()
921 lz->firstpass = 0; in cycle_new()
923 return (PyObject *)lz; in cycle_new()
927 cycle_dealloc(cycleobject *lz) in cycle_dealloc() argument
929 PyObject_GC_UnTrack(lz); in cycle_dealloc()
930 Py_XDECREF(lz->it); in cycle_dealloc()
931 Py_XDECREF(lz->saved); in cycle_dealloc()
932 Py_TYPE(lz)->tp_free(lz); in cycle_dealloc()
936 cycle_traverse(cycleobject *lz, visitproc visit, void *arg) in cycle_traverse() argument
938 if (lz->it) in cycle_traverse()
939 Py_VISIT(lz->it); in cycle_traverse()
940 Py_VISIT(lz->saved); in cycle_traverse()
945 cycle_next(cycleobject *lz) in cycle_next() argument
949 if (lz->it != NULL) { in cycle_next()
950 item = PyIter_Next(lz->it); in cycle_next()
952 if (lz->firstpass) in cycle_next()
954 if (PyList_Append(lz->saved, item)) { in cycle_next()
963 Py_CLEAR(lz->it); in cycle_next()
965 if (PyList_GET_SIZE(lz->saved) == 0) in cycle_next()
967 item = PyList_GET_ITEM(lz->saved, lz->index); in cycle_next()
968 lz->index++; in cycle_next()
969 if (lz->index >= PyList_GET_SIZE(lz->saved)) in cycle_next()
970 lz->index = 0; in cycle_next()
976 cycle_reduce(cycleobject *lz) in cycle_reduce() argument
979 if (lz->it == NULL) { in cycle_reduce()
980 PyObject *it = PyObject_GetIter(lz->saved); in cycle_reduce()
983 if (lz->index != 0) { in cycle_reduce()
986 "n", lz->index); in cycle_reduce()
993 return Py_BuildValue("O(N)(Oi)", Py_TYPE(lz), it, lz->saved, 1); in cycle_reduce()
995 return Py_BuildValue("O(O)(Oi)", Py_TYPE(lz), lz->it, lz->saved, in cycle_reduce()
996 lz->firstpass); in cycle_reduce()
1000 cycle_setstate(cycleobject *lz, PyObject *state) in cycle_setstate() argument
1012 Py_XSETREF(lz->saved, saved); in cycle_setstate()
1013 lz->firstpass = firstpass != 0; in cycle_setstate()
1014 lz->index = 0; in cycle_setstate()
1093 dropwhileobject *lz; in dropwhile_new() local
1107 lz = (dropwhileobject *)type->tp_alloc(type, 0); in dropwhile_new()
1108 if (lz == NULL) { in dropwhile_new()
1113 lz->func = func; in dropwhile_new()
1114 lz->it = it; in dropwhile_new()
1115 lz->start = 0; in dropwhile_new()
1117 return (PyObject *)lz; in dropwhile_new()
1121 dropwhile_dealloc(dropwhileobject *lz) in dropwhile_dealloc() argument
1123 PyObject_GC_UnTrack(lz); in dropwhile_dealloc()
1124 Py_XDECREF(lz->func); in dropwhile_dealloc()
1125 Py_XDECREF(lz->it); in dropwhile_dealloc()
1126 Py_TYPE(lz)->tp_free(lz); in dropwhile_dealloc()
1130 dropwhile_traverse(dropwhileobject *lz, visitproc visit, void *arg) in dropwhile_traverse() argument
1132 Py_VISIT(lz->it); in dropwhile_traverse()
1133 Py_VISIT(lz->func); in dropwhile_traverse()
1138 dropwhile_next(dropwhileobject *lz) in dropwhile_next() argument
1141 PyObject *it = lz->it; in dropwhile_next()
1150 if (lz->start == 1) in dropwhile_next()
1153 good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); in dropwhile_next()
1161 lz->start = 1; in dropwhile_next()
1171 dropwhile_reduce(dropwhileobject *lz) in dropwhile_reduce() argument
1173 return Py_BuildValue("O(OO)l", Py_TYPE(lz), lz->func, lz->it, lz->start); in dropwhile_reduce()
1177 dropwhile_setstate(dropwhileobject *lz, PyObject *state) in dropwhile_setstate() argument
1182 lz->start = start; in dropwhile_setstate()
1261 takewhileobject *lz; in takewhile_new() local
1275 lz = (takewhileobject *)type->tp_alloc(type, 0); in takewhile_new()
1276 if (lz == NULL) { in takewhile_new()
1281 lz->func = func; in takewhile_new()
1282 lz->it = it; in takewhile_new()
1283 lz->stop = 0; in takewhile_new()
1285 return (PyObject *)lz; in takewhile_new()
1289 takewhile_dealloc(takewhileobject *lz) in takewhile_dealloc() argument
1291 PyObject_GC_UnTrack(lz); in takewhile_dealloc()
1292 Py_XDECREF(lz->func); in takewhile_dealloc()
1293 Py_XDECREF(lz->it); in takewhile_dealloc()
1294 Py_TYPE(lz)->tp_free(lz); in takewhile_dealloc()
1298 takewhile_traverse(takewhileobject *lz, visitproc visit, void *arg) in takewhile_traverse() argument
1300 Py_VISIT(lz->it); in takewhile_traverse()
1301 Py_VISIT(lz->func); in takewhile_traverse()
1306 takewhile_next(takewhileobject *lz) in takewhile_next() argument
1309 PyObject *it = lz->it; in takewhile_next()
1312 if (lz->stop == 1) in takewhile_next()
1319 good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); in takewhile_next()
1330 lz->stop = 1; in takewhile_next()
1335 takewhile_reduce(takewhileobject *lz) in takewhile_reduce() argument
1337 return Py_BuildValue("O(OO)l", Py_TYPE(lz), lz->func, lz->it, lz->stop); in takewhile_reduce()
1341 takewhile_reduce_setstate(takewhileobject *lz, PyObject *state) in takewhile_reduce_setstate() argument
1347 lz->stop = stop; in takewhile_reduce_setstate()
1429 isliceobject *lz; in islice_new() local
1492 lz = (isliceobject *)type->tp_alloc(type, 0); in islice_new()
1493 if (lz == NULL) { in islice_new()
1497 lz->it = it; in islice_new()
1498 lz->next = start; in islice_new()
1499 lz->stop = stop; in islice_new()
1500 lz->step = step; in islice_new()
1501 lz->cnt = 0L; in islice_new()
1503 return (PyObject *)lz; in islice_new()
1507 islice_dealloc(isliceobject *lz) in islice_dealloc() argument
1509 PyObject_GC_UnTrack(lz); in islice_dealloc()
1510 Py_XDECREF(lz->it); in islice_dealloc()
1511 Py_TYPE(lz)->tp_free(lz); in islice_dealloc()
1515 islice_traverse(isliceobject *lz, visitproc visit, void *arg) in islice_traverse() argument
1517 Py_VISIT(lz->it); in islice_traverse()
1522 islice_next(isliceobject *lz) in islice_next() argument
1525 PyObject *it = lz->it; in islice_next()
1526 Py_ssize_t stop = lz->stop; in islice_next()
1534 while (lz->cnt < lz->next) { in islice_next()
1539 lz->cnt++; in islice_next()
1541 if (stop != -1 && lz->cnt >= stop) in islice_next()
1546 lz->cnt++; in islice_next()
1547 oldnext = lz->next; in islice_next()
1550 lz->next += (size_t)lz->step; in islice_next()
1551 if (lz->next < oldnext || (stop != -1 && lz->next > stop)) in islice_next()
1552 lz->next = stop; in islice_next()
1556 Py_CLEAR(lz->it); in islice_next()
1561 islice_reduce(isliceobject *lz) in islice_reduce() argument
1568 if (lz->it == NULL) { in islice_reduce()
1578 return Py_BuildValue("O(Nn)n", Py_TYPE(lz), empty_it, 0, 0); in islice_reduce()
1580 if (lz->stop == -1) { in islice_reduce()
1584 stop = PyLong_FromSsize_t(lz->stop); in islice_reduce()
1588 return Py_BuildValue("O(OnNn)n", Py_TYPE(lz), in islice_reduce()
1589 lz->it, lz->next, stop, lz->step, in islice_reduce()
1590 lz->cnt); in islice_reduce()
1594 islice_setstate(isliceobject *lz, PyObject *state) in islice_setstate() argument
1600 lz->cnt = cnt; in islice_setstate()
1683 starmapobject *lz; in starmap_new() local
1697 lz = (starmapobject *)type->tp_alloc(type, 0); in starmap_new()
1698 if (lz == NULL) { in starmap_new()
1703 lz->func = func; in starmap_new()
1704 lz->it = it; in starmap_new()
1706 return (PyObject *)lz; in starmap_new()
1710 starmap_dealloc(starmapobject *lz) in starmap_dealloc() argument
1712 PyObject_GC_UnTrack(lz); in starmap_dealloc()
1713 Py_XDECREF(lz->func); in starmap_dealloc()
1714 Py_XDECREF(lz->it); in starmap_dealloc()
1715 Py_TYPE(lz)->tp_free(lz); in starmap_dealloc()
1719 starmap_traverse(starmapobject *lz, visitproc visit, void *arg) in starmap_traverse() argument
1721 Py_VISIT(lz->it); in starmap_traverse()
1722 Py_VISIT(lz->func); in starmap_traverse()
1727 starmap_next(starmapobject *lz) in starmap_next() argument
1731 PyObject *it = lz->it; in starmap_next()
1743 result = PyObject_Call(lz->func, args, NULL); in starmap_next()
1749 starmap_reduce(starmapobject *lz) in starmap_reduce() argument
1752 return Py_BuildValue("O(OO)", Py_TYPE(lz), lz->func, lz->it); in starmap_reduce()
1825 chainobject *lz; in chain_new_internal() local
1827 lz = (chainobject *)type->tp_alloc(type, 0); in chain_new_internal()
1828 if (lz == NULL) { in chain_new_internal()
1833 lz->source = source; in chain_new_internal()
1834 lz->active = NULL; in chain_new_internal()
1835 return (PyObject *)lz; in chain_new_internal()
1866 chain_dealloc(chainobject *lz) in chain_dealloc() argument
1868 PyObject_GC_UnTrack(lz); in chain_dealloc()
1869 Py_XDECREF(lz->active); in chain_dealloc()
1870 Py_XDECREF(lz->source); in chain_dealloc()
1871 Py_TYPE(lz)->tp_free(lz); in chain_dealloc()
1875 chain_traverse(chainobject *lz, visitproc visit, void *arg) in chain_traverse() argument
1877 Py_VISIT(lz->source); in chain_traverse()
1878 Py_VISIT(lz->active); in chain_traverse()
1883 chain_next(chainobject *lz) in chain_next() argument
1890 while (lz->source != NULL) { in chain_next()
1891 if (lz->active == NULL) { in chain_next()
1892 PyObject *iterable = PyIter_Next(lz->source); in chain_next()
1894 Py_CLEAR(lz->source); in chain_next()
1897 lz->active = PyObject_GetIter(iterable); in chain_next()
1899 if (lz->active == NULL) { in chain_next()
1900 Py_CLEAR(lz->source); in chain_next()
1904 item = (*Py_TYPE(lz->active)->tp_iternext)(lz->active); in chain_next()
1914 Py_CLEAR(lz->active); in chain_next()
1921 chain_reduce(chainobject *lz) in chain_reduce() argument
1923 if (lz->source) { in chain_reduce()
1928 if (lz->active) { in chain_reduce()
1929 return Py_BuildValue("O()(OO)", Py_TYPE(lz), lz->source, lz->active); in chain_reduce()
1931 return Py_BuildValue("O()(O)", Py_TYPE(lz), lz->source); in chain_reduce()
1934 return Py_BuildValue("O()", Py_TYPE(lz)); /* exhausted */ in chain_reduce()
1940 chain_setstate(chainobject *lz, PyObject *state) in chain_setstate() argument
1957 Py_XSETREF(lz->source, source); in chain_setstate()
1959 Py_XSETREF(lz->active, active); in chain_setstate()
2046 productobject *lz; in product_new() local
2108 lz = (productobject *)type->tp_alloc(type, 0); in product_new()
2109 if (lz == NULL) in product_new()
2112 lz->pools = pools; in product_new()
2113 lz->indices = indices; in product_new()
2114 lz->result = NULL; in product_new()
2115 lz->stopped = 0; in product_new()
2117 return (PyObject *)lz; in product_new()
2127 product_dealloc(productobject *lz) in product_dealloc() argument
2129 PyObject_GC_UnTrack(lz); in product_dealloc()
2130 Py_XDECREF(lz->pools); in product_dealloc()
2131 Py_XDECREF(lz->result); in product_dealloc()
2132 if (lz->indices != NULL) in product_dealloc()
2133 PyMem_Free(lz->indices); in product_dealloc()
2134 Py_TYPE(lz)->tp_free(lz); in product_dealloc()
2138 product_sizeof(productobject *lz, void *unused) in product_sizeof() argument
2142 res = _PyObject_SIZE(Py_TYPE(lz)); in product_sizeof()
2143 res += PyTuple_GET_SIZE(lz->pools) * sizeof(Py_ssize_t); in product_sizeof()
2150 product_traverse(productobject *lz, visitproc visit, void *arg) in product_traverse() argument
2152 Py_VISIT(lz->pools); in product_traverse()
2153 Py_VISIT(lz->result); in product_traverse()
2158 product_next(productobject *lz) in product_next() argument
2163 PyObject *pools = lz->pools; in product_next()
2164 PyObject *result = lz->result; in product_next()
2168 if (lz->stopped) in product_next()
2177 lz->result = result; in product_next()
2187 Py_ssize_t *indices = lz->indices; in product_next()
2195 lz->result = result; in product_next()
2240 lz->stopped = 1; in product_next()
2245 product_reduce(productobject *lz) in product_reduce() argument
2247 if (lz->stopped) { in product_reduce()
2248 return Py_BuildValue("O(())", Py_TYPE(lz)); in product_reduce()
2249 } else if (lz->result == NULL) { in product_reduce()
2250 return Py_BuildValue("OO", Py_TYPE(lz), lz->pools); in product_reduce()
2258 n = PyTuple_GET_SIZE(lz->pools); in product_reduce()
2263 PyObject* index = PyLong_FromSsize_t(lz->indices[i]); in product_reduce()
2270 return Py_BuildValue("OON", Py_TYPE(lz), lz->pools, indices); in product_reduce()
2275 product_setstate(productobject *lz, PyObject *state) in product_setstate() argument
2280 n = PyTuple_GET_SIZE(lz->pools); in product_setstate()
2293 pool = PyTuple_GET_ITEM(lz->pools, i); in product_setstate()
2296 lz->stopped = 1; in product_setstate()
2304 lz->indices[i] = index; in product_setstate()
2311 PyObject *pool = PyTuple_GET_ITEM(lz->pools, i); in product_setstate()
2312 PyObject *element = PyTuple_GET_ITEM(pool, lz->indices[i]); in product_setstate()
2316 Py_XSETREF(lz->result, result); in product_setstate()
2572 combinations_reduce(combinationsobject *lz) in combinations_reduce() argument
2574 if (lz->result == NULL) { in combinations_reduce()
2575 return Py_BuildValue("O(On)", Py_TYPE(lz), lz->pool, lz->r); in combinations_reduce()
2576 } else if (lz->stopped) { in combinations_reduce()
2577 return Py_BuildValue("O(()n)", Py_TYPE(lz), lz->r); in combinations_reduce()
2583 indices = PyTuple_New(lz->r); in combinations_reduce()
2586 for (i=0; i<lz->r; i++) in combinations_reduce()
2588 PyObject* index = PyLong_FromSsize_t(lz->indices[i]); in combinations_reduce()
2596 return Py_BuildValue("O(On)N", Py_TYPE(lz), lz->pool, lz->r, indices); in combinations_reduce()
2601 combinations_setstate(combinationsobject *lz, PyObject *state) in combinations_setstate() argument
2605 Py_ssize_t n = PyTuple_GET_SIZE(lz->pool); in combinations_setstate()
2607 if (!PyTuple_Check(state) || PyTuple_GET_SIZE(state) != lz->r) { in combinations_setstate()
2612 for (i=0; i<lz->r; i++) { in combinations_setstate()
2619 max = i + n - lz->r; in combinations_setstate()
2625 lz->indices[i] = index; in combinations_setstate()
2628 result = PyTuple_New(lz->r); in combinations_setstate()
2631 for (i=0; i<lz->r; i++) { in combinations_setstate()
2632 PyObject *element = PyTuple_GET_ITEM(lz->pool, lz->indices[i]); in combinations_setstate()
2637 Py_XSETREF(lz->result, result); in combinations_setstate()
2906 cwr_reduce(cwrobject *lz) in cwr_reduce() argument
2908 if (lz->result == NULL) { in cwr_reduce()
2909 return Py_BuildValue("O(On)", Py_TYPE(lz), lz->pool, lz->r); in cwr_reduce()
2910 } else if (lz->stopped) { in cwr_reduce()
2911 return Py_BuildValue("O(()n)", Py_TYPE(lz), lz->r); in cwr_reduce()
2917 indices = PyTuple_New(lz->r); in cwr_reduce()
2920 for (i=0; i<lz->r; i++) { in cwr_reduce()
2921 PyObject* index = PyLong_FromSsize_t(lz->indices[i]); in cwr_reduce()
2929 return Py_BuildValue("O(On)N", Py_TYPE(lz), lz->pool, lz->r, indices); in cwr_reduce()
2934 cwr_setstate(cwrobject *lz, PyObject *state) in cwr_setstate() argument
2939 if (!PyTuple_Check(state) || PyTuple_GET_SIZE(state) != lz->r) in cwr_setstate()
2945 n = PyTuple_GET_SIZE(lz->pool); in cwr_setstate()
2946 for (i=0; i<lz->r; i++) { in cwr_setstate()
2957 lz->indices[i] = index; in cwr_setstate()
2959 result = PyTuple_New(lz->r); in cwr_setstate()
2962 for (i=0; i<lz->r; i++) { in cwr_setstate()
2963 PyObject *element = PyTuple_GET_ITEM(lz->pool, lz->indices[i]); in cwr_setstate()
2967 Py_XSETREF(lz->result, result); in cwr_setstate()
3442 accumulateobject *lz; in accumulate_new() local
3454 lz = (accumulateobject *)type->tp_alloc(type, 0); in accumulate_new()
3455 if (lz == NULL) { in accumulate_new()
3462 lz->binop = binop; in accumulate_new()
3464 lz->total = NULL; in accumulate_new()
3465 lz->it = it; in accumulate_new()
3466 return (PyObject *)lz; in accumulate_new()
3470 accumulate_dealloc(accumulateobject *lz) in accumulate_dealloc() argument
3472 PyObject_GC_UnTrack(lz); in accumulate_dealloc()
3473 Py_XDECREF(lz->binop); in accumulate_dealloc()
3474 Py_XDECREF(lz->total); in accumulate_dealloc()
3475 Py_XDECREF(lz->it); in accumulate_dealloc()
3476 Py_TYPE(lz)->tp_free(lz); in accumulate_dealloc()
3480 accumulate_traverse(accumulateobject *lz, visitproc visit, void *arg) in accumulate_traverse() argument
3482 Py_VISIT(lz->binop); in accumulate_traverse()
3483 Py_VISIT(lz->it); in accumulate_traverse()
3484 Py_VISIT(lz->total); in accumulate_traverse()
3489 accumulate_next(accumulateobject *lz) in accumulate_next() argument
3493 val = (*Py_TYPE(lz->it)->tp_iternext)(lz->it); in accumulate_next()
3497 if (lz->total == NULL) { in accumulate_next()
3499 lz->total = val; in accumulate_next()
3500 return lz->total; in accumulate_next()
3503 if (lz->binop == NULL) in accumulate_next()
3504 newtotal = PyNumber_Add(lz->total, val); in accumulate_next()
3506 newtotal = PyObject_CallFunctionObjArgs(lz->binop, lz->total, val, NULL); in accumulate_next()
3512 Py_SETREF(lz->total, newtotal); in accumulate_next()
3517 accumulate_reduce(accumulateobject *lz) in accumulate_reduce() argument
3519 if (lz->total == Py_None) { in accumulate_reduce()
3527 lz->total, lz->it); in accumulate_reduce()
3530 it = PyObject_CallFunction((PyObject *)Py_TYPE(lz), "NO", in accumulate_reduce()
3531 it, lz->binop ? lz->binop : Py_None); in accumulate_reduce()
3536 return Py_BuildValue("O(OO)O", Py_TYPE(lz), in accumulate_reduce()
3537 lz->it, lz->binop?lz->binop:Py_None, in accumulate_reduce()
3538 lz->total?lz->total:Py_None); in accumulate_reduce()
3542 accumulate_setstate(accumulateobject *lz, PyObject *state) in accumulate_setstate() argument
3545 Py_XSETREF(lz->total, state); in accumulate_setstate()
3629 compressobject *lz; in compress_new() local
3643 lz = (compressobject *)type->tp_alloc(type, 0); in compress_new()
3644 if (lz == NULL) in compress_new()
3646 lz->data = data; in compress_new()
3647 lz->selectors = selectors; in compress_new()
3648 return (PyObject *)lz; in compress_new()
3657 compress_dealloc(compressobject *lz) in compress_dealloc() argument
3659 PyObject_GC_UnTrack(lz); in compress_dealloc()
3660 Py_XDECREF(lz->data); in compress_dealloc()
3661 Py_XDECREF(lz->selectors); in compress_dealloc()
3662 Py_TYPE(lz)->tp_free(lz); in compress_dealloc()
3666 compress_traverse(compressobject *lz, visitproc visit, void *arg) in compress_traverse() argument
3668 Py_VISIT(lz->data); in compress_traverse()
3669 Py_VISIT(lz->selectors); in compress_traverse()
3674 compress_next(compressobject *lz) in compress_next() argument
3676 PyObject *data = lz->data, *selectors = lz->selectors; in compress_next()
3710 compress_reduce(compressobject *lz) in compress_reduce() argument
3712 return Py_BuildValue("O(OO)", Py_TYPE(lz), in compress_reduce()
3713 lz->data, lz->selectors); in compress_reduce()
3789 filterfalseobject *lz; in filterfalse_new() local
3804 lz = (filterfalseobject *)type->tp_alloc(type, 0); in filterfalse_new()
3805 if (lz == NULL) { in filterfalse_new()
3810 lz->func = func; in filterfalse_new()
3811 lz->it = it; in filterfalse_new()
3813 return (PyObject *)lz; in filterfalse_new()
3817 filterfalse_dealloc(filterfalseobject *lz) in filterfalse_dealloc() argument
3819 PyObject_GC_UnTrack(lz); in filterfalse_dealloc()
3820 Py_XDECREF(lz->func); in filterfalse_dealloc()
3821 Py_XDECREF(lz->it); in filterfalse_dealloc()
3822 Py_TYPE(lz)->tp_free(lz); in filterfalse_dealloc()
3826 filterfalse_traverse(filterfalseobject *lz, visitproc visit, void *arg) in filterfalse_traverse() argument
3828 Py_VISIT(lz->it); in filterfalse_traverse()
3829 Py_VISIT(lz->func); in filterfalse_traverse()
3834 filterfalse_next(filterfalseobject *lz) in filterfalse_next() argument
3837 PyObject *it = lz->it; in filterfalse_next()
3847 if (lz->func == Py_None || lz->func == (PyObject *)&PyBool_Type) { in filterfalse_next()
3851 good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); in filterfalse_next()
3868 filterfalse_reduce(filterfalseobject *lz) in filterfalse_reduce() argument
3870 return Py_BuildValue("O(OO)", Py_TYPE(lz), lz->func, lz->it); in filterfalse_reduce()
3961 countobject *lz; in count_new() local
4027 lz = (countobject *)type->tp_alloc(type, 0); in count_new()
4028 if (lz == NULL) { in count_new()
4032 lz->cnt = cnt; in count_new()
4033 lz->long_cnt = long_cnt; in count_new()
4034 lz->long_step = long_step; in count_new()
4036 return (PyObject *)lz; in count_new()
4040 count_dealloc(countobject *lz) in count_dealloc() argument
4042 PyObject_GC_UnTrack(lz); in count_dealloc()
4043 Py_XDECREF(lz->long_cnt); in count_dealloc()
4044 Py_XDECREF(lz->long_step); in count_dealloc()
4045 Py_TYPE(lz)->tp_free(lz); in count_dealloc()
4049 count_traverse(countobject *lz, visitproc visit, void *arg) in count_traverse() argument
4051 Py_VISIT(lz->long_cnt); in count_traverse()
4052 Py_VISIT(lz->long_step); in count_traverse()
4057 count_nextlong(countobject *lz) in count_nextlong() argument
4062 long_cnt = lz->long_cnt; in count_nextlong()
4069 assert(lz->cnt == PY_SSIZE_T_MAX && long_cnt != NULL); in count_nextlong()
4071 stepped_up = PyNumber_Add(long_cnt, lz->long_step); in count_nextlong()
4074 lz->long_cnt = stepped_up; in count_nextlong()
4079 count_next(countobject *lz) in count_next() argument
4081 if (lz->cnt == PY_SSIZE_T_MAX) in count_next()
4082 return count_nextlong(lz); in count_next()
4083 return PyLong_FromSsize_t(lz->cnt++); in count_next()
4087 count_repr(countobject *lz) in count_repr() argument
4089 if (lz->cnt != PY_SSIZE_T_MAX) in count_repr()
4091 _PyType_Name(Py_TYPE(lz)), lz->cnt); in count_repr()
4093 if (PyLong_Check(lz->long_step)) { in count_repr()
4094 long step = PyLong_AsLong(lz->long_step); in count_repr()
4101 _PyType_Name(Py_TYPE(lz)), in count_repr()
4102 lz->long_cnt); in count_repr()
4106 _PyType_Name(Py_TYPE(lz)), in count_repr()
4107 lz->long_cnt, lz->long_step); in count_repr()
4111 count_reduce(countobject *lz) in count_reduce() argument
4113 if (lz->cnt == PY_SSIZE_T_MAX) in count_reduce()
4114 return Py_BuildValue("O(OO)", Py_TYPE(lz), lz->long_cnt, lz->long_step); in count_reduce()
4115 return Py_BuildValue("O(n)", Py_TYPE(lz), lz->cnt); in count_reduce()
4350 ziplongestobject *lz; in zip_longest_new() local
4400 lz = (ziplongestobject *)type->tp_alloc(type, 0); in zip_longest_new()
4401 if (lz == NULL) { in zip_longest_new()
4406 lz->ittuple = ittuple; in zip_longest_new()
4407 lz->tuplesize = tuplesize; in zip_longest_new()
4408 lz->numactive = tuplesize; in zip_longest_new()
4409 lz->result = result; in zip_longest_new()
4411 lz->fillvalue = fillvalue; in zip_longest_new()
4412 return (PyObject *)lz; in zip_longest_new()
4416 zip_longest_dealloc(ziplongestobject *lz) in zip_longest_dealloc() argument
4418 PyObject_GC_UnTrack(lz); in zip_longest_dealloc()
4419 Py_XDECREF(lz->ittuple); in zip_longest_dealloc()
4420 Py_XDECREF(lz->result); in zip_longest_dealloc()
4421 Py_XDECREF(lz->fillvalue); in zip_longest_dealloc()
4422 Py_TYPE(lz)->tp_free(lz); in zip_longest_dealloc()
4426 zip_longest_traverse(ziplongestobject *lz, visitproc visit, void *arg) in zip_longest_traverse() argument
4428 Py_VISIT(lz->ittuple); in zip_longest_traverse()
4429 Py_VISIT(lz->result); in zip_longest_traverse()
4430 Py_VISIT(lz->fillvalue); in zip_longest_traverse()
4435 zip_longest_next(ziplongestobject *lz) in zip_longest_next() argument
4438 Py_ssize_t tuplesize = lz->tuplesize; in zip_longest_next()
4439 PyObject *result = lz->result; in zip_longest_next()
4446 if (lz->numactive == 0) in zip_longest_next()
4451 it = PyTuple_GET_ITEM(lz->ittuple, i); in zip_longest_next()
4453 Py_INCREF(lz->fillvalue); in zip_longest_next()
4454 item = lz->fillvalue; in zip_longest_next()
4458 lz->numactive -= 1; in zip_longest_next()
4459 if (lz->numactive == 0 || PyErr_Occurred()) { in zip_longest_next()
4460 lz->numactive = 0; in zip_longest_next()
4464 Py_INCREF(lz->fillvalue); in zip_longest_next()
4465 item = lz->fillvalue; in zip_longest_next()
4466 PyTuple_SET_ITEM(lz->ittuple, i, NULL); in zip_longest_next()
4480 it = PyTuple_GET_ITEM(lz->ittuple, i); in zip_longest_next()
4482 Py_INCREF(lz->fillvalue); in zip_longest_next()
4483 item = lz->fillvalue; in zip_longest_next()
4487 lz->numactive -= 1; in zip_longest_next()
4488 if (lz->numactive == 0 || PyErr_Occurred()) { in zip_longest_next()
4489 lz->numactive = 0; in zip_longest_next()
4493 Py_INCREF(lz->fillvalue); in zip_longest_next()
4494 item = lz->fillvalue; in zip_longest_next()
4495 PyTuple_SET_ITEM(lz->ittuple, i, NULL); in zip_longest_next()
4507 zip_longest_reduce(ziplongestobject *lz) in zip_longest_reduce() argument
4514 PyObject *args = PyTuple_New(PyTuple_GET_SIZE(lz->ittuple)); in zip_longest_reduce()
4518 for (i=0; i<PyTuple_GET_SIZE(lz->ittuple); i++) { in zip_longest_reduce()
4519 PyObject *elem = PyTuple_GET_ITEM(lz->ittuple, i); in zip_longest_reduce()
4530 return Py_BuildValue("ONO", Py_TYPE(lz), args, lz->fillvalue); in zip_longest_reduce()
4534 zip_longest_setstate(ziplongestobject *lz, PyObject *state) in zip_longest_setstate() argument
4537 Py_XSETREF(lz->fillvalue, state); in zip_longest_setstate()