Lines Matching full:en
43 enumobject *en; in enum_new_impl() local
45 en = (enumobject *)type->tp_alloc(type, 0); in enum_new_impl()
46 if (en == NULL) in enum_new_impl()
51 Py_DECREF(en); in enum_new_impl()
55 en->en_index = PyLong_AsSsize_t(start); in enum_new_impl()
56 if (en->en_index == -1 && PyErr_Occurred()) { in enum_new_impl()
58 en->en_index = PY_SSIZE_T_MAX; in enum_new_impl()
59 en->en_longindex = start; in enum_new_impl()
61 en->en_longindex = NULL; in enum_new_impl()
65 en->en_index = 0; in enum_new_impl()
66 en->en_longindex = NULL; in enum_new_impl()
68 en->en_sit = PyObject_GetIter(iterable); in enum_new_impl()
69 if (en->en_sit == NULL) { in enum_new_impl()
70 Py_DECREF(en); in enum_new_impl()
73 en->en_result = PyTuple_Pack(2, Py_None, Py_None); in enum_new_impl()
74 if (en->en_result == NULL) { in enum_new_impl()
75 Py_DECREF(en); in enum_new_impl()
78 return (PyObject *)en; in enum_new_impl()
82 enum_dealloc(enumobject *en) in enum_dealloc() argument
84 PyObject_GC_UnTrack(en); in enum_dealloc()
85 Py_XDECREF(en->en_sit); in enum_dealloc()
86 Py_XDECREF(en->en_result); in enum_dealloc()
87 Py_XDECREF(en->en_longindex); in enum_dealloc()
88 Py_TYPE(en)->tp_free(en); in enum_dealloc()
92 enum_traverse(enumobject *en, visitproc visit, void *arg) in enum_traverse() argument
94 Py_VISIT(en->en_sit); in enum_traverse()
95 Py_VISIT(en->en_result); in enum_traverse()
96 Py_VISIT(en->en_longindex); in enum_traverse()
101 enum_next_long(enumobject *en, PyObject* next_item) in enum_next_long() argument
103 PyObject *result = en->en_result; in enum_next_long()
109 if (en->en_longindex == NULL) { in enum_next_long()
110 en->en_longindex = PyLong_FromSsize_t(PY_SSIZE_T_MAX); in enum_next_long()
111 if (en->en_longindex == NULL) { in enum_next_long()
116 next_index = en->en_longindex; in enum_next_long()
123 en->en_longindex = stepped_up; in enum_next_long()
147 enum_next(enumobject *en) in enum_next() argument
151 PyObject *result = en->en_result; in enum_next()
152 PyObject *it = en->en_sit; in enum_next()
160 if (en->en_index == PY_SSIZE_T_MAX) in enum_next()
161 return enum_next_long(en, next_item); in enum_next()
163 next_index = PyLong_FromSsize_t(en->en_index); in enum_next()
168 en->en_index++; in enum_next()
192 enum_reduce(enumobject *en, PyObject *Py_UNUSED(ignored)) in enum_reduce() argument
194 if (en->en_longindex != NULL) in enum_reduce()
195 return Py_BuildValue("O(OO)", Py_TYPE(en), en->en_sit, en->en_longindex); in enum_reduce()
197 return Py_BuildValue("O(On)", Py_TYPE(en), en->en_sit, en->en_index); in enum_reduce()