Mercurial > cpython-lru_cache-weakref
annotate Objects/iterobject.c @ 21283:d4907cdcc299 legacy-trunk
Use an immutable tuple for __slots instead of a mutable list
Bump version number
| author | Andrew M. Kuchling <amk@amk.ca> |
|---|---|
| date | Fri, 07 Dec 2001 14:22:13 +0000 |
| parents | b9701538f827 |
| children | 7ca46e08200d 6706b83d1bd1 |
| rev | line source |
|---|---|
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 /* Iterator objects */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 #include "Python.h" |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 typedef struct { |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 PyObject_HEAD |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 long it_index; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 PyObject *it_seq; |
|
17617
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
9 } seqiterobject; |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 PyObject * |
|
17617
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
12 PySeqIter_New(PyObject *seq) |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 { |
|
17617
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
14 seqiterobject *it; |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
15 it = PyObject_NEW(seqiterobject, &PySeqIter_Type); |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 if (it == NULL) |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 return NULL; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 it->it_index = 0; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
19 Py_INCREF(seq); |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 it->it_seq = seq; |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
21 PyObject_GC_Init(it); |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
22 return (PyObject *)it; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
23 } |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
24 static void |
|
17617
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
25 iter_dealloc(seqiterobject *it) |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 { |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
27 PyObject_GC_Fini(it); |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
28 Py_DECREF(it->it_seq); |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
29 it = (seqiterobject *) PyObject_AS_GC(it); |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
30 PyObject_DEL(it); |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 } |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
33 static int |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
34 iter_traverse(seqiterobject *it, visitproc visit, void *arg) |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
35 { |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
36 return visit(it->it_seq, arg); |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
37 } |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
38 |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 static PyObject * |
|
19301
b9701538f827
Patch #427190: Implement and use METH_NOARGS and METH_O.
Martin v. Löwis <martin@v.loewis.de>
parents:
18933
diff
changeset
|
40 iter_next(seqiterobject *it) |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
41 { |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
42 PyObject *seq = it->it_seq; |
|
17617
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
43 PyObject *result = PySequence_GetItem(seq, it->it_index++); |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
44 |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
45 if (result == NULL && PyErr_ExceptionMatches(PyExc_IndexError)) |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
46 PyErr_SetObject(PyExc_StopIteration, Py_None); |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
47 return result; |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
48 } |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
49 |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
50 static PyObject * |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
51 iter_getiter(PyObject *it) |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
52 { |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
53 Py_INCREF(it); |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
54 return it; |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
55 } |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
56 |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
57 static PyObject * |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
58 iter_iternext(PyObject *iterator) |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
59 { |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
60 seqiterobject *it; |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
61 PyObject *seq; |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
62 |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
63 assert(PySeqIter_Check(iterator)); |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
64 it = (seqiterobject *)iterator; |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
65 seq = it->it_seq; |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
66 |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
67 if (PyList_Check(seq)) { |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
68 PyObject *item; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
69 if (it->it_index >= PyList_GET_SIZE(seq)) { |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
70 return NULL; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
71 } |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
72 item = PyList_GET_ITEM(seq, it->it_index); |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
73 it->it_index++; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
74 Py_INCREF(item); |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
75 return item; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
76 } |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
77 else { |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
78 PyObject *result = PySequence_GetItem(seq, it->it_index++); |
|
17617
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
79 if (result != NULL) { |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
80 return result; |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
81 } |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
82 if (PyErr_ExceptionMatches(PyExc_IndexError) || |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
83 PyErr_ExceptionMatches(PyExc_StopIteration)) { |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
84 PyErr_Clear(); |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
85 return NULL; |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
86 } |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
87 else { |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
88 return NULL; |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
89 } |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
90 } |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
91 } |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
92 |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
93 static PyMethodDef iter_methods[] = { |
|
19301
b9701538f827
Patch #427190: Implement and use METH_NOARGS and METH_O.
Martin v. Löwis <martin@v.loewis.de>
parents:
18933
diff
changeset
|
94 {"next", (PyCFunction)iter_next, METH_NOARGS, |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
95 "it.next() -- get the next value, or raise StopIteration"}, |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
96 {NULL, NULL} /* sentinel */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
97 }; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
98 |
|
17617
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
99 PyTypeObject PySeqIter_Type = { |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
100 PyObject_HEAD_INIT(&PyType_Type) |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
101 0, /* ob_size */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
102 "iterator", /* tp_name */ |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
103 sizeof(seqiterobject) + PyGC_HEAD_SIZE, /* tp_basicsize */ |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
104 0, /* tp_itemsize */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
105 /* methods */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
106 (destructor)iter_dealloc, /* tp_dealloc */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
107 0, /* tp_print */ |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
108 0, /* tp_getattr */ |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
109 0, /* tp_setattr */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
110 0, /* tp_compare */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
111 0, /* tp_repr */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
112 0, /* tp_as_number */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
113 0, /* tp_as_sequence */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
114 0, /* tp_as_mapping */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
115 0, /* tp_hash */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
116 0, /* tp_call */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
117 0, /* tp_str */ |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
118 PyObject_GenericGetAttr, /* tp_getattro */ |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
119 0, /* tp_setattro */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
120 0, /* tp_as_buffer */ |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
121 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
122 0, /* tp_doc */ |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
123 (traverseproc)iter_traverse, /* tp_traverse */ |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
124 0, /* tp_clear */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
125 0, /* tp_richcompare */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
126 0, /* tp_weaklistoffset */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
127 (getiterfunc)iter_getiter, /* tp_iter */ |
|
17617
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
128 (iternextfunc)iter_iternext, /* tp_iternext */ |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
129 iter_methods, /* tp_methods */ |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
130 0, /* tp_members */ |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
131 0, /* tp_getset */ |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
132 0, /* tp_base */ |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
133 0, /* tp_dict */ |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
134 0, /* tp_descr_get */ |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
135 0, /* tp_descr_set */ |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
136 }; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
137 |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
138 /* -------------------------------------- */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
139 |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
140 typedef struct { |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
141 PyObject_HEAD |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
142 PyObject *it_callable; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
143 PyObject *it_sentinel; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
144 } calliterobject; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
145 |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
146 PyObject * |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
147 PyCallIter_New(PyObject *callable, PyObject *sentinel) |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
148 { |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
149 calliterobject *it; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
150 it = PyObject_NEW(calliterobject, &PyCallIter_Type); |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
151 if (it == NULL) |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
152 return NULL; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
153 Py_INCREF(callable); |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
154 it->it_callable = callable; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
155 Py_INCREF(sentinel); |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
156 it->it_sentinel = sentinel; |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
157 PyObject_GC_Init(it); |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
158 return (PyObject *)it; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
159 } |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
160 static void |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
161 calliter_dealloc(calliterobject *it) |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
162 { |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
163 PyObject_GC_Fini(it); |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
164 Py_DECREF(it->it_callable); |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
165 Py_DECREF(it->it_sentinel); |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
166 it = (calliterobject *) PyObject_AS_GC(it); |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
167 PyObject_DEL(it); |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
168 } |
|
17617
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
169 |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
170 static int |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
171 calliter_traverse(calliterobject *it, visitproc visit, void *arg) |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
172 { |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
173 int err; |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
174 if ((err = visit(it->it_callable, arg))) |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
175 return err; |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
176 if ((err = visit(it->it_sentinel, arg))) |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
177 return err; |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
178 return 0; |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
179 } |
|
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
180 |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
181 static PyObject * |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
182 calliter_next(calliterobject *it, PyObject *args) |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
183 { |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
184 PyObject *result = PyObject_CallObject(it->it_callable, NULL); |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
185 if (result != NULL) { |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
186 if (PyObject_RichCompareBool(result, it->it_sentinel, Py_EQ)) { |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
187 PyErr_SetObject(PyExc_StopIteration, Py_None); |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
188 Py_DECREF(result); |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
189 result = NULL; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
190 } |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
191 } |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
192 return result; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
193 } |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
194 |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
195 static PyMethodDef calliter_methods[] = { |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
196 {"next", (PyCFunction)calliter_next, METH_VARARGS, |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
197 "it.next() -- get the next value, or raise StopIteration"}, |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
198 {NULL, NULL} /* sentinel */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
199 }; |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
200 |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
201 static PyObject * |
|
17617
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
202 calliter_iternext(calliterobject *it) |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
203 { |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
204 PyObject *result = PyObject_CallObject(it->it_callable, NULL); |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
205 if (result != NULL) { |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
206 if (PyObject_RichCompareBool(result, it->it_sentinel, Py_EQ)) { |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
207 Py_DECREF(result); |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
208 result = NULL; |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
209 } |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
210 } |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
211 else if (PyErr_ExceptionMatches(PyExc_StopIteration)) { |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
212 PyErr_Clear(); |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
213 } |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
214 return result; |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
215 } |
|
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
216 |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
217 PyTypeObject PyCallIter_Type = { |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
218 PyObject_HEAD_INIT(&PyType_Type) |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
219 0, /* ob_size */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
220 "callable-iterator", /* tp_name */ |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
221 sizeof(calliterobject) + PyGC_HEAD_SIZE,/* tp_basicsize */ |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
222 0, /* tp_itemsize */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
223 /* methods */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
224 (destructor)calliter_dealloc, /* tp_dealloc */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
225 0, /* tp_print */ |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
226 0, /* tp_getattr */ |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
227 0, /* tp_setattr */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
228 0, /* tp_compare */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
229 0, /* tp_repr */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
230 0, /* tp_as_number */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
231 0, /* tp_as_sequence */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
232 0, /* tp_as_mapping */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
233 0, /* tp_hash */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
234 0, /* tp_call */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
235 0, /* tp_str */ |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
236 PyObject_GenericGetAttr, /* tp_getattro */ |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
237 0, /* tp_setattro */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
238 0, /* tp_as_buffer */ |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
239 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /* tp_flags */ |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
240 0, /* tp_doc */ |
|
18511
d211709f25f1
GC for iterator objects.
Neil Schemenauer <nascheme@enme.ucalgary.ca>
parents:
17647
diff
changeset
|
241 (traverseproc)calliter_traverse, /* tp_traverse */ |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
242 0, /* tp_clear */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
243 0, /* tp_richcompare */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
244 0, /* tp_weaklistoffset */ |
|
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
245 (getiterfunc)iter_getiter, /* tp_iter */ |
|
17617
aac65f50df6f
Mondo changes to the iterator stuff, without changing how Python code
Guido van Rossum <guido@python.org>
parents:
17598
diff
changeset
|
246 (iternextfunc)calliter_iternext, /* tp_iternext */ |
|
18933
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
247 calliter_methods, /* tp_methods */ |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
248 0, /* tp_members */ |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
249 0, /* tp_getset */ |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
250 0, /* tp_base */ |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
251 0, /* tp_dict */ |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
252 0, /* tp_descr_get */ |
|
09df3254b49d
Merge of descr-branch back into trunk.
Tim Peters <tim.peters@gmail.com>
parents:
18511
diff
changeset
|
253 0, /* tp_descr_set */ |
|
17598
c3bb0ff396dc
Adding iterobject.[ch], which were accidentally not added. Sorry\!
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
254 }; |
