Mercurial > cpython-lru_cache-weakref
annotate Modules/itertoolsmodule.c @ 48345:cb871f736be0
merge error: test.test_support is now test.support
| author | Amaury Forgeot d'Arc <amauryfa@gmail.com> |
|---|---|
| date | Thu, 19 Jun 2008 22:03:50 +0000 |
| parents | 94f64f11fdd0 |
| children | fffd10c12a1b |
| rev | line source |
|---|---|
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2 #include "Python.h" |
|
33779
c66e6c9ffc2d
some platforms still need offsetof() from structmember.h
Fred Drake <fdrake@acm.org>
parents:
33777
diff
changeset
|
3 #include "structmember.h" |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
4 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
5 /* Itertools module written and maintained |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
6 by Raymond D. Hettinger <python@rcn.com> |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
7 Copyright (c) 2003 Python Software Foundation. |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
8 All rights reserved. |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
9 */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
10 |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
11 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
12 /* groupby object ***********************************************************/ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
13 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
14 typedef struct { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
15 PyObject_HEAD |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
16 PyObject *it; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
17 PyObject *keyfunc; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
18 PyObject *tgtkey; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
19 PyObject *currkey; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
20 PyObject *currvalue; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
21 } groupbyobject; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
22 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
23 static PyTypeObject groupby_type; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
24 static PyObject *_grouper_create(groupbyobject *, PyObject *); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
25 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
26 static PyObject * |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
27 groupby_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
28 { |
| 36684 | 29 static char *kwargs[] = {"iterable", "key", NULL}; |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
30 groupbyobject *gbo; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
31 PyObject *it, *keyfunc = Py_None; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
32 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
33 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:groupby", kwargs, |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
34 &it, &keyfunc)) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
35 return NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
36 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
37 gbo = (groupbyobject *)type->tp_alloc(type, 0); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
38 if (gbo == NULL) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
39 return NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
40 gbo->tgtkey = NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
41 gbo->currkey = NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
42 gbo->currvalue = NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
43 gbo->keyfunc = keyfunc; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
44 Py_INCREF(keyfunc); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
45 gbo->it = PyObject_GetIter(it); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
46 if (gbo->it == NULL) { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
47 Py_DECREF(gbo); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
48 return NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
49 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
50 return (PyObject *)gbo; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
51 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
52 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
53 static void |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
54 groupby_dealloc(groupbyobject *gbo) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
55 { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
56 PyObject_GC_UnTrack(gbo); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
57 Py_XDECREF(gbo->it); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
58 Py_XDECREF(gbo->keyfunc); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
59 Py_XDECREF(gbo->tgtkey); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
60 Py_XDECREF(gbo->currkey); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
61 Py_XDECREF(gbo->currvalue); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
62 Py_TYPE(gbo)->tp_free(gbo); |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
63 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
64 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
65 static int |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
66 groupby_traverse(groupbyobject *gbo, visitproc visit, void *arg) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
67 { |
|
32682
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
68 Py_VISIT(gbo->it); |
|
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
69 Py_VISIT(gbo->keyfunc); |
|
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
70 Py_VISIT(gbo->tgtkey); |
|
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
71 Py_VISIT(gbo->currkey); |
|
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
72 Py_VISIT(gbo->currvalue); |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
73 return 0; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
74 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
75 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
76 static PyObject * |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
77 groupby_next(groupbyobject *gbo) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
78 { |
|
33616
31b08670ebdd
* Increase test coverage.
Raymond Hettinger <python@rcn.com>
parents:
33386
diff
changeset
|
79 PyObject *newvalue, *newkey, *r, *grouper, *tmp; |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
80 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
81 /* skip to next iteration group */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
82 for (;;) { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
83 if (gbo->currkey == NULL) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
84 /* pass */; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
85 else if (gbo->tgtkey == NULL) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
86 break; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
87 else { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
88 int rcmp; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
89 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
90 rcmp = PyObject_RichCompareBool(gbo->tgtkey, |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
91 gbo->currkey, Py_EQ); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
92 if (rcmp == -1) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
93 return NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
94 else if (rcmp == 0) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
95 break; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
96 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
97 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
98 newvalue = PyIter_Next(gbo->it); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
99 if (newvalue == NULL) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
100 return NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
101 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
102 if (gbo->keyfunc == Py_None) { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
103 newkey = newvalue; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
104 Py_INCREF(newvalue); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
105 } else { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
106 newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
107 newvalue, NULL); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
108 if (newkey == NULL) { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
109 Py_DECREF(newvalue); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
110 return NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
111 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
112 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
113 |
|
33616
31b08670ebdd
* Increase test coverage.
Raymond Hettinger <python@rcn.com>
parents:
33386
diff
changeset
|
114 tmp = gbo->currkey; |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
115 gbo->currkey = newkey; |
|
33616
31b08670ebdd
* Increase test coverage.
Raymond Hettinger <python@rcn.com>
parents:
33386
diff
changeset
|
116 Py_XDECREF(tmp); |
|
31b08670ebdd
* Increase test coverage.
Raymond Hettinger <python@rcn.com>
parents:
33386
diff
changeset
|
117 |
|
31b08670ebdd
* Increase test coverage.
Raymond Hettinger <python@rcn.com>
parents:
33386
diff
changeset
|
118 tmp = gbo->currvalue; |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
119 gbo->currvalue = newvalue; |
|
33616
31b08670ebdd
* Increase test coverage.
Raymond Hettinger <python@rcn.com>
parents:
33386
diff
changeset
|
120 Py_XDECREF(tmp); |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
121 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
122 |
|
33616
31b08670ebdd
* Increase test coverage.
Raymond Hettinger <python@rcn.com>
parents:
33386
diff
changeset
|
123 Py_INCREF(gbo->currkey); |
|
31b08670ebdd
* Increase test coverage.
Raymond Hettinger <python@rcn.com>
parents:
33386
diff
changeset
|
124 tmp = gbo->tgtkey; |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
125 gbo->tgtkey = gbo->currkey; |
|
33616
31b08670ebdd
* Increase test coverage.
Raymond Hettinger <python@rcn.com>
parents:
33386
diff
changeset
|
126 Py_XDECREF(tmp); |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
127 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
128 grouper = _grouper_create(gbo, gbo->tgtkey); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
129 if (grouper == NULL) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
130 return NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
131 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
132 r = PyTuple_Pack(2, gbo->currkey, grouper); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
133 Py_DECREF(grouper); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
134 return r; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
135 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
136 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
137 PyDoc_STRVAR(groupby_doc, |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
138 "groupby(iterable[, keyfunc]) -> create an iterator which returns\n\ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
139 (key, sub-iterator) grouped by each value of key(value).\n"); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
140 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
141 static PyTypeObject groupby_type = { |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
142 PyVarObject_HEAD_INIT(NULL, 0) |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
143 "itertools.groupby", /* tp_name */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
144 sizeof(groupbyobject), /* tp_basicsize */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
145 0, /* tp_itemsize */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
146 /* methods */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
147 (destructor)groupby_dealloc, /* tp_dealloc */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
148 0, /* tp_print */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
149 0, /* tp_getattr */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
150 0, /* tp_setattr */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
151 0, /* tp_compare */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
152 0, /* tp_repr */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
153 0, /* tp_as_number */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
154 0, /* tp_as_sequence */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
155 0, /* tp_as_mapping */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
156 0, /* tp_hash */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
157 0, /* tp_call */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
158 0, /* tp_str */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
159 PyObject_GenericGetAttr, /* tp_getattro */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
160 0, /* tp_setattro */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
161 0, /* tp_as_buffer */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
162 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
163 Py_TPFLAGS_BASETYPE, /* tp_flags */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
164 groupby_doc, /* tp_doc */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
165 (traverseproc)groupby_traverse, /* tp_traverse */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
166 0, /* tp_clear */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
167 0, /* tp_richcompare */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
168 0, /* tp_weaklistoffset */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
169 PyObject_SelfIter, /* tp_iter */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
170 (iternextfunc)groupby_next, /* tp_iternext */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
171 0, /* tp_methods */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
172 0, /* tp_members */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
173 0, /* tp_getset */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
174 0, /* tp_base */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
175 0, /* tp_dict */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
176 0, /* tp_descr_get */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
177 0, /* tp_descr_set */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
178 0, /* tp_dictoffset */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
179 0, /* tp_init */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
180 0, /* tp_alloc */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
181 groupby_new, /* tp_new */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
182 PyObject_GC_Del, /* tp_free */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
183 }; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
184 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
185 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
186 /* _grouper object (internal) ************************************************/ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
187 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
188 typedef struct { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
189 PyObject_HEAD |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
190 PyObject *parent; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
191 PyObject *tgtkey; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
192 } _grouperobject; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
193 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
194 static PyTypeObject _grouper_type; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
195 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
196 static PyObject * |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
197 _grouper_create(groupbyobject *parent, PyObject *tgtkey) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
198 { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
199 _grouperobject *igo; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
200 |
|
45773
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
201 igo = PyObject_GC_New(_grouperobject, &_grouper_type); |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
202 if (igo == NULL) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
203 return NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
204 igo->parent = (PyObject *)parent; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
205 Py_INCREF(parent); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
206 igo->tgtkey = tgtkey; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
207 Py_INCREF(tgtkey); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
208 |
|
45773
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
209 PyObject_GC_Track(igo); |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
210 return (PyObject *)igo; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
211 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
212 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
213 static void |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
214 _grouper_dealloc(_grouperobject *igo) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
215 { |
|
45773
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
216 PyObject_GC_UnTrack(igo); |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
217 Py_DECREF(igo->parent); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
218 Py_DECREF(igo->tgtkey); |
|
45773
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
219 PyObject_GC_Del(igo); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
220 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
221 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
222 static int |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
223 _grouper_traverse(_grouperobject *igo, visitproc visit, void *arg) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
224 { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
225 Py_VISIT(igo->parent); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
226 Py_VISIT(igo->tgtkey); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
227 return 0; |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
228 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
229 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
230 static PyObject * |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
231 _grouper_next(_grouperobject *igo) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
232 { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
233 groupbyobject *gbo = (groupbyobject *)igo->parent; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
234 PyObject *newvalue, *newkey, *r; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
235 int rcmp; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
236 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
237 if (gbo->currvalue == NULL) { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
238 newvalue = PyIter_Next(gbo->it); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
239 if (newvalue == NULL) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
240 return NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
241 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
242 if (gbo->keyfunc == Py_None) { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
243 newkey = newvalue; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
244 Py_INCREF(newvalue); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
245 } else { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
246 newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
247 newvalue, NULL); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
248 if (newkey == NULL) { |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
249 Py_DECREF(newvalue); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
250 return NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
251 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
252 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
253 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
254 assert(gbo->currkey == NULL); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
255 gbo->currkey = newkey; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
256 gbo->currvalue = newvalue; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
257 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
258 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
259 assert(gbo->currkey != NULL); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
260 rcmp = PyObject_RichCompareBool(igo->tgtkey, gbo->currkey, Py_EQ); |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
261 if (rcmp <= 0) |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
262 /* got any error or current group is end */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
263 return NULL; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
264 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
265 r = gbo->currvalue; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
266 gbo->currvalue = NULL; |
|
33386
c2c49ee727d0
SF patch #1020188: Use Py_CLEAR where necessary to avoid crashes
Raymond Hettinger <python@rcn.com>
parents:
32682
diff
changeset
|
267 Py_CLEAR(gbo->currkey); |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
268 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
269 return r; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
270 } |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
271 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
272 static PyTypeObject _grouper_type = { |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
273 PyVarObject_HEAD_INIT(NULL, 0) |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
274 "itertools._grouper", /* tp_name */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
275 sizeof(_grouperobject), /* tp_basicsize */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
276 0, /* tp_itemsize */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
277 /* methods */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
278 (destructor)_grouper_dealloc, /* tp_dealloc */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
279 0, /* tp_print */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
280 0, /* tp_getattr */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
281 0, /* tp_setattr */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
282 0, /* tp_compare */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
283 0, /* tp_repr */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
284 0, /* tp_as_number */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
285 0, /* tp_as_sequence */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
286 0, /* tp_as_mapping */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
287 0, /* tp_hash */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
288 0, /* tp_call */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
289 0, /* tp_str */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
290 PyObject_GenericGetAttr, /* tp_getattro */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
291 0, /* tp_setattro */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
292 0, /* tp_as_buffer */ |
|
45773
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
293 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
294 0, /* tp_doc */ |
|
45773
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
295 (traverseproc)_grouper_traverse,/* tp_traverse */ |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
296 0, /* tp_clear */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
297 0, /* tp_richcompare */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
298 0, /* tp_weaklistoffset */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
299 PyObject_SelfIter, /* tp_iter */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
300 (iternextfunc)_grouper_next, /* tp_iternext */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
301 0, /* tp_methods */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
302 0, /* tp_members */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
303 0, /* tp_getset */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
304 0, /* tp_base */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
305 0, /* tp_dict */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
306 0, /* tp_descr_get */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
307 0, /* tp_descr_set */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
308 0, /* tp_dictoffset */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
309 0, /* tp_init */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
310 0, /* tp_alloc */ |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
311 0, /* tp_new */ |
|
45773
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
312 PyObject_GC_Del, /* tp_free */ |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
313 }; |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
314 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
315 |
|
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
316 |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
317 /* tee object and with supporting function and objects ***************/ |
| 30764 | 318 |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
319 /* The teedataobject pre-allocates space for LINKCELLS number of objects. |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
320 To help the object fit neatly inside cache lines (space for 16 to 32 |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
321 pointers), the value should be a multiple of 16 minus space for |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
322 the other structure members including PyHEAD overhead. The larger the |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
323 value, the less memory overhead per object and the less time spent |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
324 allocating/deallocating new links. The smaller the number, the less |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
325 wasted space and the more rapid freeing of older data. |
| 30764 | 326 */ |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
327 #define LINKCELLS 57 |
| 30764 | 328 |
| 329 typedef struct { | |
| 330 PyObject_HEAD | |
| 331 PyObject *it; | |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
332 int numread; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
333 PyObject *nextlink; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
334 PyObject *(values[LINKCELLS]); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
335 } teedataobject; |
| 30764 | 336 |
| 337 typedef struct { | |
| 338 PyObject_HEAD | |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
339 teedataobject *dataobj; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
340 int index; |
|
33777
e4b7c923ed5f
Fix and test weak referencing of itertools.tee objects.
Raymond Hettinger <python@rcn.com>
parents:
33646
diff
changeset
|
341 PyObject *weakreflist; |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
342 } teeobject; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
343 |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
344 static PyTypeObject teedataobject_type; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
345 |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
346 static PyObject * |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
347 teedataobject_new(PyObject *it) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
348 { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
349 teedataobject *tdo; |
| 30764 | 350 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
351 tdo = PyObject_GC_New(teedataobject, &teedataobject_type); |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
352 if (tdo == NULL) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
353 return NULL; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
354 |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
355 tdo->numread = 0; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
356 tdo->nextlink = NULL; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
357 Py_INCREF(it); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
358 tdo->it = it; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
359 PyObject_GC_Track(tdo); |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
360 return (PyObject *)tdo; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
361 } |
| 30764 | 362 |
| 363 static PyObject * | |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
364 teedataobject_jumplink(teedataobject *tdo) |
| 30764 | 365 { |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
366 if (tdo->nextlink == NULL) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
367 tdo->nextlink = teedataobject_new(tdo->it); |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
368 Py_XINCREF(tdo->nextlink); |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
369 return tdo->nextlink; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
370 } |
| 30764 | 371 |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
372 static PyObject * |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
373 teedataobject_getitem(teedataobject *tdo, int i) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
374 { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
375 PyObject *value; |
| 30764 | 376 |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
377 assert(i < LINKCELLS); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
378 if (i < tdo->numread) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
379 value = tdo->values[i]; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
380 else { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
381 /* this is the lead iterator, so fetch more data */ |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
382 assert(i == tdo->numread); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
383 value = PyIter_Next(tdo->it); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
384 if (value == NULL) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
385 return NULL; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
386 tdo->numread++; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
387 tdo->values[i] = value; |
| 30764 | 388 } |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
389 Py_INCREF(value); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
390 return value; |
| 30764 | 391 } |
| 392 | |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
393 static int |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
394 teedataobject_traverse(teedataobject *tdo, visitproc visit, void * arg) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
395 { |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
396 int i; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
397 Py_VISIT(tdo->it); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
398 for (i = 0; i < tdo->numread; i++) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
399 Py_VISIT(tdo->values[i]); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
400 Py_VISIT(tdo->nextlink); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
401 return 0; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
402 } |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
403 |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
404 static int |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
405 teedataobject_clear(teedataobject *tdo) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
406 { |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
407 int i; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
408 Py_CLEAR(tdo->it); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
409 for (i=0 ; i<tdo->numread ; i++) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
410 Py_CLEAR(tdo->values[i]); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
411 Py_CLEAR(tdo->nextlink); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
412 return 0; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
413 } |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
414 |
| 30764 | 415 static void |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
416 teedataobject_dealloc(teedataobject *tdo) |
| 30764 | 417 { |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
418 PyObject_GC_UnTrack(tdo); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
419 teedataobject_clear(tdo); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
420 PyObject_GC_Del(tdo); |
| 30764 | 421 } |
| 422 | |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
423 PyDoc_STRVAR(teedataobject_doc, "Data container common to multiple tee objects."); |
| 30764 | 424 |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
425 static PyTypeObject teedataobject_type = { |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
426 PyVarObject_HEAD_INIT(0, 0) /* Must fill in type value later */ |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
427 "itertools.tee_dataobject", /* tp_name */ |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
428 sizeof(teedataobject), /* tp_basicsize */ |
| 30764 | 429 0, /* tp_itemsize */ |
| 430 /* methods */ | |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
431 (destructor)teedataobject_dealloc, /* tp_dealloc */ |
| 30764 | 432 0, /* tp_print */ |
| 433 0, /* tp_getattr */ | |
| 434 0, /* tp_setattr */ | |
| 435 0, /* tp_compare */ | |
| 436 0, /* tp_repr */ | |
| 437 0, /* tp_as_number */ | |
| 438 0, /* tp_as_sequence */ | |
| 439 0, /* tp_as_mapping */ | |
| 440 0, /* tp_hash */ | |
| 441 0, /* tp_call */ | |
| 442 0, /* tp_str */ | |
| 443 PyObject_GenericGetAttr, /* tp_getattro */ | |
| 444 0, /* tp_setattro */ | |
| 445 0, /* tp_as_buffer */ | |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
446 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
447 teedataobject_doc, /* tp_doc */ |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
448 (traverseproc)teedataobject_traverse, /* tp_traverse */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
449 (inquiry)teedataobject_clear, /* tp_clear */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
450 0, /* tp_richcompare */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
451 0, /* tp_weaklistoffset */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
452 0, /* tp_iter */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
453 0, /* tp_iternext */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
454 0, /* tp_methods */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
455 0, /* tp_members */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
456 0, /* tp_getset */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
457 0, /* tp_base */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
458 0, /* tp_dict */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
459 0, /* tp_descr_get */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
460 0, /* tp_descr_set */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
461 0, /* tp_dictoffset */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
462 0, /* tp_init */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
463 0, /* tp_alloc */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
464 0, /* tp_new */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
465 PyObject_GC_Del, /* tp_free */ |
| 30764 | 466 }; |
| 467 | |
| 468 | |
| 469 static PyTypeObject tee_type; | |
| 470 | |
| 471 static PyObject * | |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
472 tee_next(teeobject *to) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
473 { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
474 PyObject *value, *link; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
475 |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
476 if (to->index >= LINKCELLS) { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
477 link = teedataobject_jumplink(to->dataobj); |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
478 Py_DECREF(to->dataobj); |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
479 to->dataobj = (teedataobject *)link; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
480 to->index = 0; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
481 } |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
482 value = teedataobject_getitem(to->dataobj, to->index); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
483 if (value == NULL) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
484 return NULL; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
485 to->index++; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
486 return value; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
487 } |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
488 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
489 static int |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
490 tee_traverse(teeobject *to, visitproc visit, void *arg) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
491 { |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
492 Py_VISIT((PyObject *)to->dataobj); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
493 return 0; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
494 } |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
495 |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
496 static PyObject * |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
497 tee_copy(teeobject *to) |
| 30764 | 498 { |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
499 teeobject *newto; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
500 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
501 newto = PyObject_GC_New(teeobject, &tee_type); |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
502 if (newto == NULL) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
503 return NULL; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
504 Py_INCREF(to->dataobj); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
505 newto->dataobj = to->dataobj; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
506 newto->index = to->index; |
|
33777
e4b7c923ed5f
Fix and test weak referencing of itertools.tee objects.
Raymond Hettinger <python@rcn.com>
parents:
33646
diff
changeset
|
507 newto->weakreflist = NULL; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
508 PyObject_GC_Track(newto); |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
509 return (PyObject *)newto; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
510 } |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
511 |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
512 PyDoc_STRVAR(teecopy_doc, "Returns an independent iterator."); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
513 |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
514 static PyObject * |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
515 tee_fromiterable(PyObject *iterable) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
516 { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
517 teeobject *to; |
| 30764 | 518 PyObject *it = NULL; |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
519 |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
520 it = PyObject_GetIter(iterable); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
521 if (it == NULL) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
522 return NULL; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
523 if (PyObject_TypeCheck(it, &tee_type)) { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
524 to = (teeobject *)tee_copy((teeobject *)it); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
525 goto done; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
526 } |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
527 |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
528 to = PyObject_GC_New(teeobject, &tee_type); |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
529 if (to == NULL) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
530 goto done; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
531 to->dataobj = (teedataobject *)teedataobject_new(it); |
|
39442
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
532 if (!to->dataobj) { |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
533 PyObject_GC_Del(to); |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
534 to = NULL; |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
535 goto done; |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
536 } |
|
654c380cf8b9
Merged revisions 46753-51188 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
38453
diff
changeset
|
537 |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
538 to->index = 0; |
|
33777
e4b7c923ed5f
Fix and test weak referencing of itertools.tee objects.
Raymond Hettinger <python@rcn.com>
parents:
33646
diff
changeset
|
539 to->weakreflist = NULL; |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
540 PyObject_GC_Track(to); |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
541 done: |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
542 Py_XDECREF(it); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
543 return (PyObject *)to; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
544 } |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
545 |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
546 static PyObject * |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
547 tee_new(PyTypeObject *type, PyObject *args, PyObject *kw) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
548 { |
| 30764 | 549 PyObject *iterable; |
| 550 | |
| 551 if (!PyArg_UnpackTuple(args, "tee", 1, 1, &iterable)) | |
| 552 return NULL; | |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
553 return tee_fromiterable(iterable); |
| 30764 | 554 } |
| 555 | |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
556 static int |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
557 tee_clear(teeobject *to) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
558 { |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
559 if (to->weakreflist != NULL) |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
560 PyObject_ClearWeakRefs((PyObject *) to); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
561 Py_CLEAR(to->dataobj); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
562 return 0; |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
563 } |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
564 |
| 30764 | 565 static void |
| 566 tee_dealloc(teeobject *to) | |
| 567 { | |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
568 PyObject_GC_UnTrack(to); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
569 tee_clear(to); |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
570 PyObject_GC_Del(to); |
| 30764 | 571 } |
| 572 | |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
573 PyDoc_STRVAR(teeobject_doc, |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
574 "Iterator wrapped to make it copyable"); |
| 30764 | 575 |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
576 static PyMethodDef tee_methods[] = { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
577 {"__copy__", (PyCFunction)tee_copy, METH_NOARGS, teecopy_doc}, |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
578 {NULL, NULL} /* sentinel */ |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
579 }; |
| 30764 | 580 |
| 581 static PyTypeObject tee_type = { | |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
582 PyVarObject_HEAD_INIT(NULL, 0) |
| 30764 | 583 "itertools.tee", /* tp_name */ |
| 584 sizeof(teeobject), /* tp_basicsize */ | |
| 585 0, /* tp_itemsize */ | |
| 586 /* methods */ | |
| 587 (destructor)tee_dealloc, /* tp_dealloc */ | |
| 588 0, /* tp_print */ | |
| 589 0, /* tp_getattr */ | |
| 590 0, /* tp_setattr */ | |
| 591 0, /* tp_compare */ | |
| 592 0, /* tp_repr */ | |
| 593 0, /* tp_as_number */ | |
| 594 0, /* tp_as_sequence */ | |
| 595 0, /* tp_as_mapping */ | |
| 596 0, /* tp_hash */ | |
| 597 0, /* tp_call */ | |
| 598 0, /* tp_str */ | |
|
30786
225d848a5f96
Minor improvements to itertools.tee():
Raymond Hettinger <python@rcn.com>
parents:
30773
diff
changeset
|
599 0, /* tp_getattro */ |
| 30764 | 600 0, /* tp_setattro */ |
| 601 0, /* tp_as_buffer */ | |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
602 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
603 teeobject_doc, /* tp_doc */ |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
604 (traverseproc)tee_traverse, /* tp_traverse */ |
|
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
605 (inquiry)tee_clear, /* tp_clear */ |
| 30764 | 606 0, /* tp_richcompare */ |
|
33777
e4b7c923ed5f
Fix and test weak referencing of itertools.tee objects.
Raymond Hettinger <python@rcn.com>
parents:
33646
diff
changeset
|
607 offsetof(teeobject, weakreflist), /* tp_weaklistoffset */ |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
608 PyObject_SelfIter, /* tp_iter */ |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
609 (iternextfunc)tee_next, /* tp_iternext */ |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
610 tee_methods, /* tp_methods */ |
| 30764 | 611 0, /* tp_members */ |
| 612 0, /* tp_getset */ | |
| 613 0, /* tp_base */ | |
| 614 0, /* tp_dict */ | |
| 615 0, /* tp_descr_get */ | |
| 616 0, /* tp_descr_set */ | |
| 617 0, /* tp_dictoffset */ | |
| 618 0, /* tp_init */ | |
| 619 0, /* tp_alloc */ | |
| 620 tee_new, /* tp_new */ | |
|
37879
f731859e9b3b
Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
Thomas Wouters <thomas@python.org>
parents:
36684
diff
changeset
|
621 PyObject_GC_Del, /* tp_free */ |
| 30764 | 622 }; |
| 623 | |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
624 static PyObject * |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
625 tee(PyObject *self, PyObject *args) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
626 { |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39442
diff
changeset
|
627 Py_ssize_t i, n=2; |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
628 PyObject *it, *iterable, *copyable, *result; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
629 |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39442
diff
changeset
|
630 if (!PyArg_ParseTuple(args, "O|n", &iterable, &n)) |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
631 return NULL; |
|
40450
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39442
diff
changeset
|
632 if (n < 0) { |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39442
diff
changeset
|
633 PyErr_SetString(PyExc_ValueError, "n must be >= 0"); |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39442
diff
changeset
|
634 return NULL; |
|
cc992d75d5b3
Four months of trunk changes (including a few releases...)
Thomas Wouters <thomas@python.org>
parents:
39442
diff
changeset
|
635 } |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
636 result = PyTuple_New(n); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
637 if (result == NULL) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
638 return NULL; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
639 if (n == 0) |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
640 return result; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
641 it = PyObject_GetIter(iterable); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
642 if (it == NULL) { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
643 Py_DECREF(result); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
644 return NULL; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
645 } |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
646 if (!PyObject_HasAttrString(it, "__copy__")) { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
647 copyable = tee_fromiterable(it); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
648 Py_DECREF(it); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
649 if (copyable == NULL) { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
650 Py_DECREF(result); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
651 return NULL; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
652 } |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
653 } else |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
654 copyable = it; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
655 PyTuple_SET_ITEM(result, 0, copyable); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
656 for (i=1 ; i<n ; i++) { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
657 copyable = PyObject_CallMethod(copyable, "__copy__", NULL); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
658 if (copyable == NULL) { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
659 Py_DECREF(result); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
660 return NULL; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
661 } |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
662 PyTuple_SET_ITEM(result, i, copyable); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
663 } |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
664 return result; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
665 } |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
666 |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
667 PyDoc_STRVAR(tee_doc, |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
668 "tee(iterable, n=2) --> tuple of n independent iterators."); |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
669 |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
670 |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
671 /* cycle object **********************************************************/ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
672 |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
673 typedef struct { |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
674 PyObject_HEAD |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
675 PyObject *it; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
676 PyObject *saved; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
677 int firstpass; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
678 } cycleobject; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
679 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
680 static PyTypeObject cycle_type; |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
681 |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
682 static PyObject * |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
683 cycle_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
684 { |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
685 PyObject *it; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
686 PyObject *iterable; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
687 PyObject *saved; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
688 cycleobject *lz; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
689 |
|
40737
6ebad2a6b990
Merged revisions 53451-53537 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40450
diff
changeset
|
690 if (type == &cycle_type && !_PyArg_NoKeywords("cycle()", kwds)) |
|
35449
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
691 return NULL; |
|
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
692 |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
693 if (!PyArg_UnpackTuple(args, "cycle", 1, 1, &iterable)) |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
694 return NULL; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
695 |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
696 /* Get iterator. */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
697 it = PyObject_GetIter(iterable); |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
698 if (it == NULL) |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
699 return NULL; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
700 |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
701 saved = PyList_New(0); |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
702 if (saved == NULL) { |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
703 Py_DECREF(it); |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
704 return NULL; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
705 } |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
706 |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
707 /* create cycleobject structure */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
708 lz = (cycleobject *)type->tp_alloc(type, 0); |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
709 if (lz == NULL) { |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
710 Py_DECREF(it); |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
711 Py_DECREF(saved); |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
712 return NULL; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
713 } |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
714 lz->it = it; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
715 lz->saved = saved; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
716 lz->firstpass = 0; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
717 |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
718 return (PyObject *)lz; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
719 } |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
720 |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
721 static void |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
722 cycle_dealloc(cycleobject *lz) |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
723 { |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
724 PyObject_GC_UnTrack(lz); |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
725 Py_XDECREF(lz->saved); |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
726 Py_XDECREF(lz->it); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
727 Py_TYPE(lz)->tp_free(lz); |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
728 } |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
729 |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
730 static int |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
731 cycle_traverse(cycleobject *lz, visitproc visit, void *arg) |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
732 { |
|
32682
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
733 Py_VISIT(lz->it); |
|
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
734 Py_VISIT(lz->saved); |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
735 return 0; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
736 } |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
737 |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
738 static PyObject * |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
739 cycle_next(cycleobject *lz) |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
740 { |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
741 PyObject *item; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
742 PyObject *it; |
|
33646
3d8d78217599
Replace structure member before decreffing.
Raymond Hettinger <python@rcn.com>
parents:
33616
diff
changeset
|
743 PyObject *tmp; |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
744 |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
745 while (1) { |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
746 item = PyIter_Next(lz->it); |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
747 if (item != NULL) { |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
748 if (!lz->firstpass) |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
749 PyList_Append(lz->saved, item); |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
750 return item; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
751 } |
|
32010
544f2172363d
SF #950057: itertools.chain doesn't "process" exceptions as they occur
Raymond Hettinger <python@rcn.com>
parents:
31909
diff
changeset
|
752 if (PyErr_Occurred()) { |
|
544f2172363d
SF #950057: itertools.chain doesn't "process" exceptions as they occur
Raymond Hettinger <python@rcn.com>
parents:
31909
diff
changeset
|
753 if (PyErr_ExceptionMatches(PyExc_StopIteration)) |
|
544f2172363d
SF #950057: itertools.chain doesn't "process" exceptions as they occur
Raymond Hettinger <python@rcn.com>
parents:
31909
diff
changeset
|
754 PyErr_Clear(); |
|
544f2172363d
SF #950057: itertools.chain doesn't "process" exceptions as they occur
Raymond Hettinger <python@rcn.com>
parents:
31909
diff
changeset
|
755 else |
|
544f2172363d
SF #950057: itertools.chain doesn't "process" exceptions as they occur
Raymond Hettinger <python@rcn.com>
parents:
31909
diff
changeset
|
756 return NULL; |
|
544f2172363d
SF #950057: itertools.chain doesn't "process" exceptions as they occur
Raymond Hettinger <python@rcn.com>
parents:
31909
diff
changeset
|
757 } |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
758 if (PyList_Size(lz->saved) == 0) |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
759 return NULL; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
760 it = PyObject_GetIter(lz->saved); |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
761 if (it == NULL) |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
762 return NULL; |
|
33646
3d8d78217599
Replace structure member before decreffing.
Raymond Hettinger <python@rcn.com>
parents:
33616
diff
changeset
|
763 tmp = lz->it; |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
764 lz->it = it; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
765 lz->firstpass = 1; |
|
33646
3d8d78217599
Replace structure member before decreffing.
Raymond Hettinger <python@rcn.com>
parents:
33616
diff
changeset
|
766 Py_DECREF(tmp); |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
767 } |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
768 } |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
769 |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
770 PyDoc_STRVAR(cycle_doc, |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
771 "cycle(iterable) --> cycle object\n\ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
772 \n\ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
773 Return elements from the iterable until it is exhausted.\n\ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
774 Then repeat the sequence indefinitely."); |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
775 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
776 static PyTypeObject cycle_type = { |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
777 PyVarObject_HEAD_INIT(NULL, 0) |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
778 "itertools.cycle", /* tp_name */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
779 sizeof(cycleobject), /* tp_basicsize */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
780 0, /* tp_itemsize */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
781 /* methods */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
782 (destructor)cycle_dealloc, /* tp_dealloc */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
783 0, /* tp_print */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
784 0, /* tp_getattr */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
785 0, /* tp_setattr */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
786 0, /* tp_compare */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
787 0, /* tp_repr */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
788 0, /* tp_as_number */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
789 0, /* tp_as_sequence */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
790 0, /* tp_as_mapping */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
791 0, /* tp_hash */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
792 0, /* tp_call */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
793 0, /* tp_str */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
794 PyObject_GenericGetAttr, /* tp_getattro */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
795 0, /* tp_setattro */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
796 0, /* tp_as_buffer */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
797 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
798 Py_TPFLAGS_BASETYPE, /* tp_flags */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
799 cycle_doc, /* tp_doc */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
800 (traverseproc)cycle_traverse, /* tp_traverse */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
801 0, /* tp_clear */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
802 0, /* tp_richcompare */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
803 0, /* tp_weaklistoffset */ |
|
28320
fd5ef7003469
Renamed PyObject_GenericGetIter to PyObject_SelfIter
Raymond Hettinger <python@rcn.com>
parents:
28308
diff
changeset
|
804 PyObject_SelfIter, /* tp_iter */ |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
805 (iternextfunc)cycle_next, /* tp_iternext */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
806 0, /* tp_methods */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
807 0, /* tp_members */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
808 0, /* tp_getset */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
809 0, /* tp_base */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
810 0, /* tp_dict */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
811 0, /* tp_descr_get */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
812 0, /* tp_descr_set */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
813 0, /* tp_dictoffset */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
814 0, /* tp_init */ |
|
29242
d72ad07c739e
PyType_GenericAlloc is inherited from object.
Raymond Hettinger <python@rcn.com>
parents:
29225
diff
changeset
|
815 0, /* tp_alloc */ |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
816 cycle_new, /* tp_new */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
817 PyObject_GC_Del, /* tp_free */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
818 }; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
819 |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
820 |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
821 /* dropwhile object **********************************************************/ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
822 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
823 typedef struct { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
824 PyObject_HEAD |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
825 PyObject *func; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
826 PyObject *it; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
827 long start; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
828 } dropwhileobject; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
829 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
830 static PyTypeObject dropwhile_type; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
831 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
832 static PyObject * |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
833 dropwhile_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
834 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
835 PyObject *func, *seq; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
836 PyObject *it; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
837 dropwhileobject *lz; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
838 |
|
40737
6ebad2a6b990
Merged revisions 53451-53537 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40450
diff
changeset
|
839 if (type == &dropwhile_type && !_PyArg_NoKeywords("dropwhile()", kwds)) |
|
35449
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
840 return NULL; |
|
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
841 |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
842 if (!PyArg_UnpackTuple(args, "dropwhile", 2, 2, &func, &seq)) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
843 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
844 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
845 /* Get iterator. */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
846 it = PyObject_GetIter(seq); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
847 if (it == NULL) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
848 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
849 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
850 /* create dropwhileobject structure */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
851 lz = (dropwhileobject *)type->tp_alloc(type, 0); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
852 if (lz == NULL) { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
853 Py_DECREF(it); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
854 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
855 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
856 Py_INCREF(func); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
857 lz->func = func; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
858 lz->it = it; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
859 lz->start = 0; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
860 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
861 return (PyObject *)lz; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
862 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
863 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
864 static void |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
865 dropwhile_dealloc(dropwhileobject *lz) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
866 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
867 PyObject_GC_UnTrack(lz); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
868 Py_XDECREF(lz->func); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
869 Py_XDECREF(lz->it); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
870 Py_TYPE(lz)->tp_free(lz); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
871 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
872 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
873 static int |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
874 dropwhile_traverse(dropwhileobject *lz, visitproc visit, void *arg) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
875 { |
|
32682
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
876 Py_VISIT(lz->it); |
|
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
877 Py_VISIT(lz->func); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
878 return 0; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
879 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
880 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
881 static PyObject * |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
882 dropwhile_next(dropwhileobject *lz) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
883 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
884 PyObject *item, *good; |
|
28117
9b4eed4bb3e2
Several of the tools can make direct calls the inner iterators.
Raymond Hettinger <python@rcn.com>
parents:
28024
diff
changeset
|
885 PyObject *it = lz->it; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
886 long ok; |
|
31675
f7374e3b279a
Speedup the inner loops for dropwhile(), islice(), ifilter(), and
Raymond Hettinger <python@rcn.com>
parents:
31508
diff
changeset
|
887 PyObject *(*iternext)(PyObject *); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
888 |
|
31675
f7374e3b279a
Speedup the inner loops for dropwhile(), islice(), ifilter(), and
Raymond Hettinger <python@rcn.com>
parents:
31508
diff
changeset
|
889 assert(PyIter_Check(it)); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
890 iternext = *Py_TYPE(it)->tp_iternext; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
891 for (;;) { |
|
31675
f7374e3b279a
Speedup the inner loops for dropwhile(), islice(), ifilter(), and
Raymond Hettinger <python@rcn.com>
parents:
31508
diff
changeset
|
892 item = iternext(it); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
893 if (item == NULL) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
894 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
895 if (lz->start == 1) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
896 return item; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
897 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
898 good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
899 if (good == NULL) { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
900 Py_DECREF(item); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
901 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
902 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
903 ok = PyObject_IsTrue(good); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
904 Py_DECREF(good); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
905 if (!ok) { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
906 lz->start = 1; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
907 return item; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
908 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
909 Py_DECREF(item); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
910 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
911 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
912 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
913 PyDoc_STRVAR(dropwhile_doc, |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
914 "dropwhile(predicate, iterable) --> dropwhile object\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
915 \n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
916 Drop items from the iterable while predicate(item) is true.\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
917 Afterwards, return every element until the iterable is exhausted."); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
918 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
919 static PyTypeObject dropwhile_type = { |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
920 PyVarObject_HEAD_INIT(NULL, 0) |
| 27769 | 921 "itertools.dropwhile", /* tp_name */ |
| 922 sizeof(dropwhileobject), /* tp_basicsize */ | |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
923 0, /* tp_itemsize */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
924 /* methods */ |
| 27769 | 925 (destructor)dropwhile_dealloc, /* tp_dealloc */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
926 0, /* tp_print */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
927 0, /* tp_getattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
928 0, /* tp_setattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
929 0, /* tp_compare */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
930 0, /* tp_repr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
931 0, /* tp_as_number */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
932 0, /* tp_as_sequence */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
933 0, /* tp_as_mapping */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
934 0, /* tp_hash */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
935 0, /* tp_call */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
936 0, /* tp_str */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
937 PyObject_GenericGetAttr, /* tp_getattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
938 0, /* tp_setattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
939 0, /* tp_as_buffer */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
940 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
941 Py_TPFLAGS_BASETYPE, /* tp_flags */ |
| 27769 | 942 dropwhile_doc, /* tp_doc */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
943 (traverseproc)dropwhile_traverse, /* tp_traverse */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
944 0, /* tp_clear */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
945 0, /* tp_richcompare */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
946 0, /* tp_weaklistoffset */ |
|
28320
fd5ef7003469
Renamed PyObject_GenericGetIter to PyObject_SelfIter
Raymond Hettinger <python@rcn.com>
parents:
28308
diff
changeset
|
947 PyObject_SelfIter, /* tp_iter */ |
| 27769 | 948 (iternextfunc)dropwhile_next, /* tp_iternext */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
949 0, /* tp_methods */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
950 0, /* tp_members */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
951 0, /* tp_getset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
952 0, /* tp_base */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
953 0, /* tp_dict */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
954 0, /* tp_descr_get */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
955 0, /* tp_descr_set */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
956 0, /* tp_dictoffset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
957 0, /* tp_init */ |
|
29242
d72ad07c739e
PyType_GenericAlloc is inherited from object.
Raymond Hettinger <python@rcn.com>
parents:
29225
diff
changeset
|
958 0, /* tp_alloc */ |
| 27769 | 959 dropwhile_new, /* tp_new */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
960 PyObject_GC_Del, /* tp_free */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
961 }; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
962 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
963 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
964 /* takewhile object **********************************************************/ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
965 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
966 typedef struct { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
967 PyObject_HEAD |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
968 PyObject *func; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
969 PyObject *it; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
970 long stop; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
971 } takewhileobject; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
972 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
973 static PyTypeObject takewhile_type; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
974 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
975 static PyObject * |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
976 takewhile_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
977 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
978 PyObject *func, *seq; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
979 PyObject *it; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
980 takewhileobject *lz; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
981 |
|
40737
6ebad2a6b990
Merged revisions 53451-53537 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40450
diff
changeset
|
982 if (type == &takewhile_type && !_PyArg_NoKeywords("takewhile()", kwds)) |
|
35449
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
983 return NULL; |
|
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
984 |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
985 if (!PyArg_UnpackTuple(args, "takewhile", 2, 2, &func, &seq)) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
986 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
987 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
988 /* Get iterator. */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
989 it = PyObject_GetIter(seq); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
990 if (it == NULL) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
991 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
992 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
993 /* create takewhileobject structure */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
994 lz = (takewhileobject *)type->tp_alloc(type, 0); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
995 if (lz == NULL) { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
996 Py_DECREF(it); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
997 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
998 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
999 Py_INCREF(func); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1000 lz->func = func; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1001 lz->it = it; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1002 lz->stop = 0; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1003 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1004 return (PyObject *)lz; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1005 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1006 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1007 static void |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1008 takewhile_dealloc(takewhileobject *lz) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1009 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1010 PyObject_GC_UnTrack(lz); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1011 Py_XDECREF(lz->func); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1012 Py_XDECREF(lz->it); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
1013 Py_TYPE(lz)->tp_free(lz); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1014 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1015 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1016 static int |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1017 takewhile_traverse(takewhileobject *lz, visitproc visit, void *arg) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1018 { |
|
32682
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
1019 Py_VISIT(lz->it); |
|
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
1020 Py_VISIT(lz->func); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1021 return 0; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1022 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1023 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1024 static PyObject * |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1025 takewhile_next(takewhileobject *lz) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1026 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1027 PyObject *item, *good; |
|
28117
9b4eed4bb3e2
Several of the tools can make direct calls the inner iterators.
Raymond Hettinger <python@rcn.com>
parents:
28024
diff
changeset
|
1028 PyObject *it = lz->it; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1029 long ok; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1030 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1031 if (lz->stop == 1) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1032 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1033 |
|
28117
9b4eed4bb3e2
Several of the tools can make direct calls the inner iterators.
Raymond Hettinger <python@rcn.com>
parents:
28024
diff
changeset
|
1034 assert(PyIter_Check(it)); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
1035 item = (*Py_TYPE(it)->tp_iternext)(it); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1036 if (item == NULL) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1037 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1038 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1039 good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1040 if (good == NULL) { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1041 Py_DECREF(item); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1042 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1043 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1044 ok = PyObject_IsTrue(good); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1045 Py_DECREF(good); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1046 if (ok) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1047 return item; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1048 Py_DECREF(item); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1049 lz->stop = 1; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1050 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1051 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1052 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1053 PyDoc_STRVAR(takewhile_doc, |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1054 "takewhile(predicate, iterable) --> takewhile object\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1055 \n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1056 Return successive entries from an iterable as long as the \n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1057 predicate evaluates to true for each entry."); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1058 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
1059 static PyTypeObject takewhile_type = { |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
1060 PyVarObject_HEAD_INIT(NULL, 0) |
| 27769 | 1061 "itertools.takewhile", /* tp_name */ |
| 1062 sizeof(takewhileobject), /* tp_basicsize */ | |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1063 0, /* tp_itemsize */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1064 /* methods */ |
| 27769 | 1065 (destructor)takewhile_dealloc, /* tp_dealloc */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1066 0, /* tp_print */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1067 0, /* tp_getattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1068 0, /* tp_setattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1069 0, /* tp_compare */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1070 0, /* tp_repr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1071 0, /* tp_as_number */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1072 0, /* tp_as_sequence */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1073 0, /* tp_as_mapping */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1074 0, /* tp_hash */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1075 0, /* tp_call */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1076 0, /* tp_str */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1077 PyObject_GenericGetAttr, /* tp_getattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1078 0, /* tp_setattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1079 0, /* tp_as_buffer */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1080 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1081 Py_TPFLAGS_BASETYPE, /* tp_flags */ |
| 27769 | 1082 takewhile_doc, /* tp_doc */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1083 (traverseproc)takewhile_traverse, /* tp_traverse */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1084 0, /* tp_clear */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1085 0, /* tp_richcompare */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1086 0, /* tp_weaklistoffset */ |
|
28320
fd5ef7003469
Renamed PyObject_GenericGetIter to PyObject_SelfIter
Raymond Hettinger <python@rcn.com>
parents:
28308
diff
changeset
|
1087 PyObject_SelfIter, /* tp_iter */ |
| 27769 | 1088 (iternextfunc)takewhile_next, /* tp_iternext */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1089 0, /* tp_methods */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1090 0, /* tp_members */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1091 0, /* tp_getset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1092 0, /* tp_base */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1093 0, /* tp_dict */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1094 0, /* tp_descr_get */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1095 0, /* tp_descr_set */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1096 0, /* tp_dictoffset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1097 0, /* tp_init */ |
|
29242
d72ad07c739e
PyType_GenericAlloc is inherited from object.
Raymond Hettinger <python@rcn.com>
parents:
29225
diff
changeset
|
1098 0, /* tp_alloc */ |
| 27769 | 1099 takewhile_new, /* tp_new */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1100 PyObject_GC_Del, /* tp_free */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1101 }; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1102 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1103 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1104 /* islice object ************************************************************/ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1105 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1106 typedef struct { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1107 PyObject_HEAD |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1108 PyObject *it; |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1109 Py_ssize_t next; |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1110 Py_ssize_t stop; |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1111 Py_ssize_t step; |
|
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1112 Py_ssize_t cnt; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1113 } isliceobject; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1114 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
1115 static PyTypeObject islice_type; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1116 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1117 static PyObject * |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1118 islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1119 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1120 PyObject *seq; |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1121 Py_ssize_t start=0, stop=-1, step=1; |
|
34108
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1122 PyObject *it, *a1=NULL, *a2=NULL, *a3=NULL; |
|
36518
9f3f87e920a6
Use Py_ssize_t for counts and sizes.
Martin v. Löwis <martin@v.loewis.de>
parents:
36484
diff
changeset
|
1123 Py_ssize_t numargs; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1124 isliceobject *lz; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1125 |
|
40737
6ebad2a6b990
Merged revisions 53451-53537 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40450
diff
changeset
|
1126 if (type == &islice_type && !_PyArg_NoKeywords("islice()", kwds)) |
|
35449
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
1127 return NULL; |
|
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
1128 |
|
34108
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1129 if (!PyArg_UnpackTuple(args, "islice", 2, 4, &seq, &a1, &a2, &a3)) |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1130 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1131 |
|
34108
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1132 numargs = PyTuple_Size(args); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1133 if (numargs == 2) { |
|
28929
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1134 if (a1 != Py_None) { |
|
44099
f324631462a2
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
Christian Heimes <christian@cheimes.de>
parents:
43734
diff
changeset
|
1135 stop = PyLong_AsSsize_t(a1); |
|
28929
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1136 if (stop == -1) { |
|
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1137 if (PyErr_Occurred()) |
|
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1138 PyErr_Clear(); |
|
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1139 PyErr_SetString(PyExc_ValueError, |
|
34108
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1140 "Stop argument for islice() must be a non-negative integer or None."); |
|
28929
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1141 return NULL; |
|
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1142 } |
|
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1143 } |
|
28930
18082b2d2ebd
The previous made the stop argument optional.
Raymond Hettinger <python@rcn.com>
parents:
28929
diff
changeset
|
1144 } else { |
|
34108
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1145 if (a1 != Py_None) |
|
44099
f324631462a2
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
Christian Heimes <christian@cheimes.de>
parents:
43734
diff
changeset
|
1146 start = PyLong_AsSsize_t(a1); |
|
34108
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1147 if (start == -1 && PyErr_Occurred()) |
|
28929
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1148 PyErr_Clear(); |
|
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1149 if (a2 != Py_None) { |
|
44099
f324631462a2
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
Christian Heimes <christian@cheimes.de>
parents:
43734
diff
changeset
|
1150 stop = PyLong_AsSsize_t(a2); |
|
28929
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1151 if (stop == -1) { |
|
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1152 if (PyErr_Occurred()) |
|
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1153 PyErr_Clear(); |
|
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1154 PyErr_SetString(PyExc_ValueError, |
|
34108
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1155 "Stop argument for islice() must be a non-negative integer or None."); |
|
28929
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1156 return NULL; |
|
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1157 } |
|
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1158 } |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1159 } |
|
28929
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1160 if (start<0 || stop<-1) { |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1161 PyErr_SetString(PyExc_ValueError, |
|
34108
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1162 "Indices for islice() must be non-negative integers or None."); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1163 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1164 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1165 |
|
34108
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1166 if (a3 != NULL) { |
|
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1167 if (a3 != Py_None) |
|
44099
f324631462a2
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
Christian Heimes <christian@cheimes.de>
parents:
43734
diff
changeset
|
1168 step = PyLong_AsSsize_t(a3); |
|
34108
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1169 if (step == -1 && PyErr_Occurred()) |
|
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1170 PyErr_Clear(); |
|
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1171 } |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1172 if (step<1) { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1173 PyErr_SetString(PyExc_ValueError, |
|
34108
1d1d6377acb1
Added optional None arguments to itertools.islice().
Raymond Hettinger <python@rcn.com>
parents:
33779
diff
changeset
|
1174 "Step for islice() must be a positive integer or None."); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1175 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1176 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1177 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1178 /* Get iterator. */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1179 it = PyObject_GetIter(seq); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1180 if (it == NULL) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1181 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1182 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1183 /* create isliceobject structure */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1184 lz = (isliceobject *)type->tp_alloc(type, 0); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1185 if (lz == NULL) { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1186 Py_DECREF(it); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1187 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1188 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1189 lz->it = it; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1190 lz->next = start; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1191 lz->stop = stop; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1192 lz->step = step; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1193 lz->cnt = 0L; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1194 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1195 return (PyObject *)lz; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1196 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1197 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1198 static void |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1199 islice_dealloc(isliceobject *lz) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1200 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1201 PyObject_GC_UnTrack(lz); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1202 Py_XDECREF(lz->it); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
1203 Py_TYPE(lz)->tp_free(lz); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1204 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1205 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1206 static int |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1207 islice_traverse(isliceobject *lz, visitproc visit, void *arg) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1208 { |
|
32682
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
1209 Py_VISIT(lz->it); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1210 return 0; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1211 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1212 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1213 static PyObject * |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1214 islice_next(isliceobject *lz) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1215 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1216 PyObject *item; |
|
28117
9b4eed4bb3e2
Several of the tools can make direct calls the inner iterators.
Raymond Hettinger <python@rcn.com>
parents:
28024
diff
changeset
|
1217 PyObject *it = lz->it; |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
1218 Py_ssize_t oldnext; |
|
31675
f7374e3b279a
Speedup the inner loops for dropwhile(), islice(), ifilter(), and
Raymond Hettinger <python@rcn.com>
parents:
31508
diff
changeset
|
1219 PyObject *(*iternext)(PyObject *); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1220 |
|
31675
f7374e3b279a
Speedup the inner loops for dropwhile(), islice(), ifilter(), and
Raymond Hettinger <python@rcn.com>
parents:
31508
diff
changeset
|
1221 assert(PyIter_Check(it)); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
1222 iternext = *Py_TYPE(it)->tp_iternext; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1223 while (lz->cnt < lz->next) { |
|
31675
f7374e3b279a
Speedup the inner loops for dropwhile(), islice(), ifilter(), and
Raymond Hettinger <python@rcn.com>
parents:
31508
diff
changeset
|
1224 item = iternext(it); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1225 if (item == NULL) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1226 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1227 Py_DECREF(item); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1228 lz->cnt++; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1229 } |
|
28929
92a1e585abf7
SF bug #730685: itertools.islice stop argument is not optional
Raymond Hettinger <python@rcn.com>
parents:
28601
diff
changeset
|
1230 if (lz->stop != -1 && lz->cnt >= lz->stop) |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1231 return NULL; |
|
28117
9b4eed4bb3e2
Several of the tools can make direct calls the inner iterators.
Raymond Hettinger <python@rcn.com>
parents:
28024
diff
changeset
|
1232 assert(PyIter_Check(it)); |
|
31675
f7374e3b279a
Speedup the inner loops for dropwhile(), islice(), ifilter(), and
Raymond Hettinger <python@rcn.com>
parents:
31508
diff
changeset
|
1233 item = iternext(it); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1234 if (item == NULL) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1235 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1236 lz->cnt++; |
|
27747
941de791b17a
SF bug #681003: itertools issues
Raymond Hettinger <python@rcn.com>
parents:
27570
diff
changeset
|
1237 oldnext = lz->next; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1238 lz->next += lz->step; |
|
27747
941de791b17a
SF bug #681003: itertools issues
Raymond Hettinger <python@rcn.com>
parents:
27570
diff
changeset
|
1239 if (lz->next < oldnext) /* Check for overflow */ |
|
941de791b17a
SF bug #681003: itertools issues
Raymond Hettinger <python@rcn.com>
parents:
27570
diff
changeset
|
1240 lz->next = lz->stop; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1241 return item; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1242 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1243 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1244 PyDoc_STRVAR(islice_doc, |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1245 "islice(iterable, [start,] stop [, step]) --> islice object\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1246 \n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1247 Return an iterator whose next() method returns selected values from an\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1248 iterable. If start is specified, will skip all preceding elements;\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1249 otherwise, start defaults to zero. Step defaults to one. If\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1250 specified as another value, step determines how many values are \n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1251 skipped between successive calls. Works like a slice() on a list\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1252 but returns an iterator."); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1253 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
1254 static PyTypeObject islice_type = { |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
1255 PyVarObject_HEAD_INIT(NULL, 0) |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1256 "itertools.islice", /* tp_name */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1257 sizeof(isliceobject), /* tp_basicsize */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1258 0, /* tp_itemsize */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1259 /* methods */ |
| 27769 | 1260 (destructor)islice_dealloc, /* tp_dealloc */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1261 0, /* tp_print */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1262 0, /* tp_getattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1263 0, /* tp_setattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1264 0, /* tp_compare */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1265 0, /* tp_repr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1266 0, /* tp_as_number */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1267 0, /* tp_as_sequence */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1268 0, /* tp_as_mapping */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1269 0, /* tp_hash */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1270 0, /* tp_call */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1271 0, /* tp_str */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1272 PyObject_GenericGetAttr, /* tp_getattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1273 0, /* tp_setattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1274 0, /* tp_as_buffer */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1275 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1276 Py_TPFLAGS_BASETYPE, /* tp_flags */ |
| 27769 | 1277 islice_doc, /* tp_doc */ |
| 1278 (traverseproc)islice_traverse, /* tp_traverse */ | |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1279 0, /* tp_clear */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1280 0, /* tp_richcompare */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1281 0, /* tp_weaklistoffset */ |
|
28320
fd5ef7003469
Renamed PyObject_GenericGetIter to PyObject_SelfIter
Raymond Hettinger <python@rcn.com>
parents:
28308
diff
changeset
|
1282 PyObject_SelfIter, /* tp_iter */ |
| 27769 | 1283 (iternextfunc)islice_next, /* tp_iternext */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1284 0, /* tp_methods */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1285 0, /* tp_members */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1286 0, /* tp_getset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1287 0, /* tp_base */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1288 0, /* tp_dict */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1289 0, /* tp_descr_get */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1290 0, /* tp_descr_set */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1291 0, /* tp_dictoffset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1292 0, /* tp_init */ |
|
29242
d72ad07c739e
PyType_GenericAlloc is inherited from object.
Raymond Hettinger <python@rcn.com>
parents:
29225
diff
changeset
|
1293 0, /* tp_alloc */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1294 islice_new, /* tp_new */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1295 PyObject_GC_Del, /* tp_free */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1296 }; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1297 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1298 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1299 /* starmap object ************************************************************/ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1300 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1301 typedef struct { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1302 PyObject_HEAD |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1303 PyObject *func; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1304 PyObject *it; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1305 } starmapobject; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1306 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
1307 static PyTypeObject starmap_type; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1308 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1309 static PyObject * |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1310 starmap_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1311 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1312 PyObject *func, *seq; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1313 PyObject *it; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1314 starmapobject *lz; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1315 |
|
40737
6ebad2a6b990
Merged revisions 53451-53537 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40450
diff
changeset
|
1316 if (type == &starmap_type && !_PyArg_NoKeywords("starmap()", kwds)) |
|
35449
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
1317 return NULL; |
|
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
1318 |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1319 if (!PyArg_UnpackTuple(args, "starmap", 2, 2, &func, &seq)) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1320 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1321 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1322 /* Get iterator. */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1323 it = PyObject_GetIter(seq); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1324 if (it == NULL) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1325 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1326 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1327 /* create starmapobject structure */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1328 lz = (starmapobject *)type->tp_alloc(type, 0); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1329 if (lz == NULL) { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1330 Py_DECREF(it); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1331 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1332 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1333 Py_INCREF(func); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1334 lz->func = func; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1335 lz->it = it; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1336 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1337 return (PyObject *)lz; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1338 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1339 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1340 static void |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1341 starmap_dealloc(starmapobject *lz) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1342 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1343 PyObject_GC_UnTrack(lz); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1344 Py_XDECREF(lz->func); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1345 Py_XDECREF(lz->it); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
1346 Py_TYPE(lz)->tp_free(lz); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1347 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1348 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1349 static int |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1350 starmap_traverse(starmapobject *lz, visitproc visit, void *arg) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1351 { |
|
32682
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
1352 Py_VISIT(lz->it); |
|
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
1353 Py_VISIT(lz->func); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1354 return 0; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1355 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1356 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1357 static PyObject * |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1358 starmap_next(starmapobject *lz) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1359 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1360 PyObject *args; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1361 PyObject *result; |
|
28117
9b4eed4bb3e2
Several of the tools can make direct calls the inner iterators.
Raymond Hettinger <python@rcn.com>
parents:
28024
diff
changeset
|
1362 PyObject *it = lz->it; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1363 |
|
28117
9b4eed4bb3e2
Several of the tools can make direct calls the inner iterators.
Raymond Hettinger <python@rcn.com>
parents:
28024
diff
changeset
|
1364 assert(PyIter_Check(it)); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
1365 args = (*Py_TYPE(it)->tp_iternext)(it); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1366 if (args == NULL) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1367 return NULL; |
|
27747
941de791b17a
SF bug #681003: itertools issues
Raymond Hettinger <python@rcn.com>
parents:
27570
diff
changeset
|
1368 if (!PyTuple_CheckExact(args)) { |
|
44742
14d4104976fc
Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44351
diff
changeset
|
1369 PyObject *newargs = PySequence_Tuple(args); |
|
27747
941de791b17a
SF bug #681003: itertools issues
Raymond Hettinger <python@rcn.com>
parents:
27570
diff
changeset
|
1370 Py_DECREF(args); |
|
44742
14d4104976fc
Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44351
diff
changeset
|
1371 if (newargs == NULL) |
|
14d4104976fc
Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44351
diff
changeset
|
1372 return NULL; |
|
14d4104976fc
Merged revisions 59985-60000,60002,60005-60007,60009-60042 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44351
diff
changeset
|
1373 args = newargs; |
|
27747
941de791b17a
SF bug #681003: itertools issues
Raymond Hettinger <python@rcn.com>
parents:
27570
diff
changeset
|
1374 } |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1375 result = PyObject_Call(lz->func, args, NULL); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1376 Py_DECREF(args); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1377 return result; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1378 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1379 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1380 PyDoc_STRVAR(starmap_doc, |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1381 "starmap(function, sequence) --> starmap object\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1382 \n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1383 Return an iterator whose values are returned from the function evaluated\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1384 with a argument tuple taken from the given sequence."); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1385 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
1386 static PyTypeObject starmap_type = { |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
1387 PyVarObject_HEAD_INIT(NULL, 0) |
| 27769 | 1388 "itertools.starmap", /* tp_name */ |
| 1389 sizeof(starmapobject), /* tp_basicsize */ | |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1390 0, /* tp_itemsize */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1391 /* methods */ |
| 27769 | 1392 (destructor)starmap_dealloc, /* tp_dealloc */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1393 0, /* tp_print */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1394 0, /* tp_getattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1395 0, /* tp_setattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1396 0, /* tp_compare */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1397 0, /* tp_repr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1398 0, /* tp_as_number */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1399 0, /* tp_as_sequence */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1400 0, /* tp_as_mapping */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1401 0, /* tp_hash */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1402 0, /* tp_call */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1403 0, /* tp_str */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1404 PyObject_GenericGetAttr, /* tp_getattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1405 0, /* tp_setattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1406 0, /* tp_as_buffer */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1407 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1408 Py_TPFLAGS_BASETYPE, /* tp_flags */ |
| 27769 | 1409 starmap_doc, /* tp_doc */ |
| 1410 (traverseproc)starmap_traverse, /* tp_traverse */ | |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1411 0, /* tp_clear */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1412 0, /* tp_richcompare */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1413 0, /* tp_weaklistoffset */ |
|
28320
fd5ef7003469
Renamed PyObject_GenericGetIter to PyObject_SelfIter
Raymond Hettinger <python@rcn.com>
parents:
28308
diff
changeset
|
1414 PyObject_SelfIter, /* tp_iter */ |
| 27769 | 1415 (iternextfunc)starmap_next, /* tp_iternext */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1416 0, /* tp_methods */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1417 0, /* tp_members */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1418 0, /* tp_getset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1419 0, /* tp_base */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1420 0, /* tp_dict */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1421 0, /* tp_descr_get */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1422 0, /* tp_descr_set */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1423 0, /* tp_dictoffset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1424 0, /* tp_init */ |
|
29242
d72ad07c739e
PyType_GenericAlloc is inherited from object.
Raymond Hettinger <python@rcn.com>
parents:
29225
diff
changeset
|
1425 0, /* tp_alloc */ |
| 27769 | 1426 starmap_new, /* tp_new */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1427 PyObject_GC_Del, /* tp_free */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1428 }; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1429 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1430 |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1431 /* chain object ************************************************************/ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1432 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1433 typedef struct { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1434 PyObject_HEAD |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1435 PyObject *source; /* Iterator over input iterables */ |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1436 PyObject *active; /* Currently running input iterator */ |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1437 } chainobject; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1438 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
1439 static PyTypeObject chain_type; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1440 |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1441 static PyObject * |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1442 chain_new_internal(PyTypeObject *type, PyObject *source) |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1443 { |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1444 chainobject *lz; |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1445 |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1446 lz = (chainobject *)type->tp_alloc(type, 0); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1447 if (lz == NULL) { |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1448 Py_DECREF(source); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1449 return NULL; |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1450 } |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1451 |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1452 lz->source = source; |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1453 lz->active = NULL; |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1454 return (PyObject *)lz; |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1455 } |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1456 |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1457 static PyObject * |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1458 chain_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1459 { |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1460 PyObject *source; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1461 |
|
40737
6ebad2a6b990
Merged revisions 53451-53537 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40450
diff
changeset
|
1462 if (type == &chain_type && !_PyArg_NoKeywords("chain()", kwds)) |
|
35449
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
1463 return NULL; |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1464 |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1465 source = PyObject_GetIter(args); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1466 if (source == NULL) |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1467 return NULL; |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1468 |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1469 return chain_new_internal(type, source); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1470 } |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1471 |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1472 static PyObject * |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1473 chain_new_from_iterable(PyTypeObject *type, PyObject *arg) |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1474 { |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1475 PyObject *source; |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1476 |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1477 source = PyObject_GetIter(arg); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1478 if (source == NULL) |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1479 return NULL; |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1480 |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1481 return chain_new_internal(type, source); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1482 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1483 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1484 static void |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1485 chain_dealloc(chainobject *lz) |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1486 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1487 PyObject_GC_UnTrack(lz); |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1488 Py_XDECREF(lz->active); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1489 Py_XDECREF(lz->source); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
1490 Py_TYPE(lz)->tp_free(lz); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1491 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1492 |
|
27747
941de791b17a
SF bug #681003: itertools issues
Raymond Hettinger <python@rcn.com>
parents:
27570
diff
changeset
|
1493 static int |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1494 chain_traverse(chainobject *lz, visitproc visit, void *arg) |
|
27747
941de791b17a
SF bug #681003: itertools issues
Raymond Hettinger <python@rcn.com>
parents:
27570
diff
changeset
|
1495 { |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1496 Py_VISIT(lz->source); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1497 Py_VISIT(lz->active); |
|
27747
941de791b17a
SF bug #681003: itertools issues
Raymond Hettinger <python@rcn.com>
parents:
27570
diff
changeset
|
1498 return 0; |
|
941de791b17a
SF bug #681003: itertools issues
Raymond Hettinger <python@rcn.com>
parents:
27570
diff
changeset
|
1499 } |
|
941de791b17a
SF bug #681003: itertools issues
Raymond Hettinger <python@rcn.com>
parents:
27570
diff
changeset
|
1500 |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1501 static PyObject * |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1502 chain_next(chainobject *lz) |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1503 { |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1504 PyObject *item; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1505 |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1506 if (lz->source == NULL) |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1507 return NULL; /* already stopped */ |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1508 |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1509 if (lz->active == NULL) { |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1510 PyObject *iterable = PyIter_Next(lz->source); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1511 if (iterable == NULL) { |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1512 Py_CLEAR(lz->source); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1513 return NULL; /* no more input sources */ |
|
32010
544f2172363d
SF #950057: itertools.chain doesn't "process" exceptions as they occur
Raymond Hettinger <python@rcn.com>
parents:
31909
diff
changeset
|
1514 } |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1515 lz->active = PyObject_GetIter(iterable); |
|
45659
dd318c3f6cb7
Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45622
diff
changeset
|
1516 Py_DECREF(iterable); |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1517 if (lz->active == NULL) { |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1518 Py_CLEAR(lz->source); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1519 return NULL; /* input not iterable */ |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1520 } |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1521 } |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1522 item = PyIter_Next(lz->active); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1523 if (item != NULL) |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1524 return item; |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1525 if (PyErr_Occurred()) { |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1526 if (PyErr_ExceptionMatches(PyExc_StopIteration)) |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1527 PyErr_Clear(); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1528 else |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1529 return NULL; /* input raised an exception */ |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1530 } |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1531 Py_CLEAR(lz->active); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1532 return chain_next(lz); /* recurse and use next active */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1533 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1534 |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1535 PyDoc_STRVAR(chain_doc, |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1536 "chain(*iterables) --> chain object\n\ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1537 \n\ |
|
41501
0c5019afc55b
PEP 3114: rename .next() to .__next__() and add next() builtin.
Georg Brandl <georg@python.org>
parents:
40893
diff
changeset
|
1538 Return a chain object whose .__next__() method returns elements from the\n\ |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1539 first iterable until it is exhausted, then elements from the next\n\ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1540 iterable, until all of the iterables are exhausted."); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1541 |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1542 PyDoc_STRVAR(chain_from_iterable_doc, |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1543 "chain.from_iterable(iterable) --> chain object\n\ |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1544 \n\ |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1545 Alternate chain() contructor taking a single iterable argument\n\ |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1546 that evaluates lazily."); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1547 |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1548 static PyMethodDef chain_methods[] = { |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1549 {"from_iterable", (PyCFunction) chain_new_from_iterable, METH_O | METH_CLASS, |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1550 chain_from_iterable_doc}, |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1551 {NULL, NULL} /* sentinel */ |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1552 }; |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1553 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
1554 static PyTypeObject chain_type = { |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
1555 PyVarObject_HEAD_INIT(NULL, 0) |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1556 "itertools.chain", /* tp_name */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1557 sizeof(chainobject), /* tp_basicsize */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1558 0, /* tp_itemsize */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1559 /* methods */ |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1560 (destructor)chain_dealloc, /* tp_dealloc */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1561 0, /* tp_print */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1562 0, /* tp_getattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1563 0, /* tp_setattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1564 0, /* tp_compare */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1565 0, /* tp_repr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1566 0, /* tp_as_number */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1567 0, /* tp_as_sequence */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1568 0, /* tp_as_mapping */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1569 0, /* tp_hash */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1570 0, /* tp_call */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1571 0, /* tp_str */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1572 PyObject_GenericGetAttr, /* tp_getattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1573 0, /* tp_setattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1574 0, /* tp_as_buffer */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1575 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1576 Py_TPFLAGS_BASETYPE, /* tp_flags */ |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1577 chain_doc, /* tp_doc */ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1578 (traverseproc)chain_traverse, /* tp_traverse */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1579 0, /* tp_clear */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1580 0, /* tp_richcompare */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1581 0, /* tp_weaklistoffset */ |
|
28320
fd5ef7003469
Renamed PyObject_GenericGetIter to PyObject_SelfIter
Raymond Hettinger <python@rcn.com>
parents:
28308
diff
changeset
|
1582 PyObject_SelfIter, /* tp_iter */ |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1583 (iternextfunc)chain_next, /* tp_iternext */ |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1584 chain_methods, /* tp_methods */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1585 0, /* tp_members */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1586 0, /* tp_getset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1587 0, /* tp_base */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1588 0, /* tp_dict */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1589 0, /* tp_descr_get */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1590 0, /* tp_descr_set */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1591 0, /* tp_dictoffset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1592 0, /* tp_init */ |
|
29242
d72ad07c739e
PyType_GenericAlloc is inherited from object.
Raymond Hettinger <python@rcn.com>
parents:
29225
diff
changeset
|
1593 0, /* tp_alloc */ |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
1594 chain_new, /* tp_new */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1595 PyObject_GC_Del, /* tp_free */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1596 }; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1597 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
1598 |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1599 /* product object ************************************************************/ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1600 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1601 typedef struct { |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1602 PyObject_HEAD |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1603 PyObject *pools; /* tuple of pool tuples */ |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1604 Py_ssize_t *indices; /* one index per pool */ |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1605 PyObject *result; /* most recently returned result tuple */ |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1606 int stopped; /* set to 1 when the product iterator is exhausted */ |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1607 } productobject; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1608 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1609 static PyTypeObject product_type; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1610 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1611 static PyObject * |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1612 product_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1613 { |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1614 productobject *lz; |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1615 Py_ssize_t nargs, npools, repeat=1; |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1616 PyObject *pools = NULL; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1617 Py_ssize_t *indices = NULL; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1618 Py_ssize_t i; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1619 |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1620 if (kwds != NULL) { |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1621 char *kwlist[] = {"repeat", 0}; |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1622 PyObject *tmpargs = PyTuple_New(0); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1623 if (tmpargs == NULL) |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1624 return NULL; |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1625 if (!PyArg_ParseTupleAndKeywords(tmpargs, kwds, "|n:product", kwlist, &repeat)) { |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1626 Py_DECREF(tmpargs); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1627 return NULL; |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1628 } |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1629 Py_DECREF(tmpargs); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1630 if (repeat < 0) { |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1631 PyErr_SetString(PyExc_ValueError, |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1632 "repeat argument cannot be negative"); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1633 return NULL; |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1634 } |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1635 } |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1636 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1637 assert(PyTuple_Check(args)); |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1638 nargs = (repeat == 0) ? 0 : PyTuple_GET_SIZE(args); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1639 npools = nargs * repeat; |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1640 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1641 indices = PyMem_Malloc(npools * sizeof(Py_ssize_t)); |
|
45622
a31b650515cb
Merged revisions 61143-61144,61146-61147,61150-61151,61157,61165-61168,61170-61173,61176-61177,61183 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45569
diff
changeset
|
1642 if (indices == NULL) { |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1643 PyErr_NoMemory(); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1644 goto error; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1645 } |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1646 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1647 pools = PyTuple_New(npools); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1648 if (pools == NULL) |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1649 goto error; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1650 |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1651 for (i=0; i < nargs ; ++i) { |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1652 PyObject *item = PyTuple_GET_ITEM(args, i); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1653 PyObject *pool = PySequence_Tuple(item); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1654 if (pool == NULL) |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1655 goto error; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1656 PyTuple_SET_ITEM(pools, i, pool); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1657 indices[i] = 0; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1658 } |
|
45569
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1659 for ( ; i < npools; ++i) { |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1660 PyObject *pool = PyTuple_GET_ITEM(pools, i - nargs); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1661 Py_INCREF(pool); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1662 PyTuple_SET_ITEM(pools, i, pool); |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1663 indices[i] = 0; |
|
937a3c5af691
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61083,61085,61092-61097,61103-61104,61110-61112,61114-61115,61117-61125 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45548
diff
changeset
|
1664 } |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1665 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1666 /* create productobject structure */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1667 lz = (productobject *)type->tp_alloc(type, 0); |
|
45548
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1668 if (lz == NULL) |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1669 goto error; |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1670 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1671 lz->pools = pools; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1672 lz->indices = indices; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1673 lz->result = NULL; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1674 lz->stopped = 0; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1675 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1676 return (PyObject *)lz; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1677 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1678 error: |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1679 if (indices != NULL) |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1680 PyMem_Free(indices); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1681 Py_XDECREF(pools); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1682 return NULL; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1683 } |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1684 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1685 static void |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1686 product_dealloc(productobject *lz) |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1687 { |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1688 PyObject_GC_UnTrack(lz); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1689 Py_XDECREF(lz->pools); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1690 Py_XDECREF(lz->result); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1691 PyMem_Free(lz->indices); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1692 Py_TYPE(lz)->tp_free(lz); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1693 } |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1694 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1695 static int |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1696 product_traverse(productobject *lz, visitproc visit, void *arg) |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1697 { |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1698 Py_VISIT(lz->pools); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1699 Py_VISIT(lz->result); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1700 return 0; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1701 } |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1702 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1703 static PyObject * |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1704 product_next(productobject *lz) |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1705 { |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1706 PyObject *pool; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1707 PyObject *elem; |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1708 PyObject *oldelem; |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1709 PyObject *pools = lz->pools; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1710 PyObject *result = lz->result; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1711 Py_ssize_t npools = PyTuple_GET_SIZE(pools); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1712 Py_ssize_t i; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1713 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1714 if (lz->stopped) |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1715 return NULL; |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1716 |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1717 if (result == NULL) { |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1718 /* On the first pass, return an initial tuple filled with the |
|
45659
dd318c3f6cb7
Merged revisions 61209-61214,61217-61222,61224-61226,61233-61237 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45622
diff
changeset
|
1719 first element from each pool. */ |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1720 result = PyTuple_New(npools); |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1721 if (result == NULL) |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1722 goto empty; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1723 lz->result = result; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1724 for (i=0; i < npools; i++) { |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1725 pool = PyTuple_GET_ITEM(pools, i); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1726 if (PyTuple_GET_SIZE(pool) == 0) |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1727 goto empty; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1728 elem = PyTuple_GET_ITEM(pool, 0); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1729 Py_INCREF(elem); |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1730 PyTuple_SET_ITEM(result, i, elem); |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1731 } |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1732 } else { |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1733 Py_ssize_t *indices = lz->indices; |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1734 |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1735 /* Copy the previous result tuple or re-use it if available */ |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1736 if (Py_REFCNT(result) > 1) { |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1737 PyObject *old_result = result; |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1738 result = PyTuple_New(npools); |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1739 if (result == NULL) |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1740 goto empty; |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1741 lz->result = result; |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1742 for (i=0; i < npools; i++) { |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1743 elem = PyTuple_GET_ITEM(old_result, i); |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1744 Py_INCREF(elem); |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1745 PyTuple_SET_ITEM(result, i, elem); |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1746 } |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1747 Py_DECREF(old_result); |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1748 } |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1749 /* Now, we've got the only copy so we can update it in-place */ |
|
45622
a31b650515cb
Merged revisions 61143-61144,61146-61147,61150-61151,61157,61165-61168,61170-61173,61176-61177,61183 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45569
diff
changeset
|
1750 assert (npools==0 || Py_REFCNT(result) == 1); |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1751 |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1752 /* Update the pool indices right-to-left. Only advance to the |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1753 next pool when the previous one rolls-over */ |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1754 for (i=npools-1 ; i >= 0 ; i--) { |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1755 pool = PyTuple_GET_ITEM(pools, i); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1756 indices[i]++; |
|
45622
a31b650515cb
Merged revisions 61143-61144,61146-61147,61150-61151,61157,61165-61168,61170-61173,61176-61177,61183 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45569
diff
changeset
|
1757 if (indices[i] == PyTuple_GET_SIZE(pool)) { |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1758 /* Roll-over and advance to next pool */ |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1759 indices[i] = 0; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1760 elem = PyTuple_GET_ITEM(pool, 0); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1761 Py_INCREF(elem); |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1762 oldelem = PyTuple_GET_ITEM(result, i); |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1763 PyTuple_SET_ITEM(result, i, elem); |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1764 Py_DECREF(oldelem); |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1765 } else { |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1766 /* No rollover. Just increment and stop here. */ |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1767 elem = PyTuple_GET_ITEM(pool, indices[i]); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1768 Py_INCREF(elem); |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1769 oldelem = PyTuple_GET_ITEM(result, i); |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1770 PyTuple_SET_ITEM(result, i, elem); |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1771 Py_DECREF(oldelem); |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1772 break; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1773 } |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1774 } |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1775 |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1776 /* If i is negative, then the indices have all rolled-over |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1777 and we're done. */ |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1778 if (i < 0) |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1779 goto empty; |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1780 } |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1781 |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1782 Py_INCREF(result); |
|
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1783 return result; |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1784 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1785 empty: |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1786 lz->stopped = 1; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1787 return NULL; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1788 } |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1789 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1790 PyDoc_STRVAR(product_doc, |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1791 "product(*iterables) --> product object\n\ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1792 \n\ |
|
45446
5e0772ed20d1
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900,60902-60906,60908,60911-60917,60919-60920,60922,60926,60929-60931,60933-60935,60937,60939-60941,60943-60954,60959-60961,60963-60969,60971-60976 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45435
diff
changeset
|
1793 Cartesian product of input iterables. Equivalent to nested for-loops.\n\n\ |
|
45435
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1794 For example, product(A, B) returns the same as: ((x,y) for x in A for y in B).\n\ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1795 The leftmost iterators are in the outermost for-loop, so the output tuples\n\ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1796 cycle in a manner similar to an odometer (with the rightmost element changing\n\ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1797 on every iteration).\n\n\ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1798 product('ab', range(3)) --> ('a',0) ('a',1) ('a',2) ('b',0) ('b',1) ('b',2)\n\ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1799 product((0,1), (0,1), (0,1)) --> (0,0,0) (0,0,1) (0,1,0) (0,1,1) (1,0,0) ..."); |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1800 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1801 static PyTypeObject product_type = { |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1802 PyVarObject_HEAD_INIT(NULL, 0) |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1803 "itertools.product", /* tp_name */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1804 sizeof(productobject), /* tp_basicsize */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1805 0, /* tp_itemsize */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1806 /* methods */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1807 (destructor)product_dealloc, /* tp_dealloc */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1808 0, /* tp_print */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1809 0, /* tp_getattr */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1810 0, /* tp_setattr */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1811 0, /* tp_compare */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1812 0, /* tp_repr */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1813 0, /* tp_as_number */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1814 0, /* tp_as_sequence */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1815 0, /* tp_as_mapping */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1816 0, /* tp_hash */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1817 0, /* tp_call */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1818 0, /* tp_str */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1819 PyObject_GenericGetAttr, /* tp_getattro */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1820 0, /* tp_setattro */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1821 0, /* tp_as_buffer */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1822 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1823 Py_TPFLAGS_BASETYPE, /* tp_flags */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1824 product_doc, /* tp_doc */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1825 (traverseproc)product_traverse, /* tp_traverse */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1826 0, /* tp_clear */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1827 0, /* tp_richcompare */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1828 0, /* tp_weaklistoffset */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1829 PyObject_SelfIter, /* tp_iter */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1830 (iternextfunc)product_next, /* tp_iternext */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1831 0, /* tp_methods */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1832 0, /* tp_members */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1833 0, /* tp_getset */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1834 0, /* tp_base */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1835 0, /* tp_dict */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1836 0, /* tp_descr_get */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1837 0, /* tp_descr_set */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1838 0, /* tp_dictoffset */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1839 0, /* tp_init */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1840 0, /* tp_alloc */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1841 product_new, /* tp_new */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1842 PyObject_GC_Del, /* tp_free */ |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1843 }; |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1844 |
|
42b3b117391d
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
44881
diff
changeset
|
1845 |
|
45548
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1846 /* combinations object ************************************************************/ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1847 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1848 typedef struct { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1849 PyObject_HEAD |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1850 PyObject *pool; /* input converted to a tuple */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1851 Py_ssize_t *indices; /* one index per result element */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1852 PyObject *result; /* most recently returned result tuple */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1853 Py_ssize_t r; /* size of result tuple */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1854 int stopped; /* set to 1 when the combinations iterator is exhausted */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1855 } combinationsobject; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1856 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1857 static PyTypeObject combinations_type; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1858 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1859 static PyObject * |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1860 combinations_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1861 { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1862 combinationsobject *co; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1863 Py_ssize_t n; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1864 Py_ssize_t r; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1865 PyObject *pool = NULL; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1866 PyObject *iterable = NULL; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1867 Py_ssize_t *indices = NULL; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1868 Py_ssize_t i; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1869 static char *kwargs[] = {"iterable", "r", NULL}; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1870 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1871 if (!PyArg_ParseTupleAndKeywords(args, kwds, "On:combinations", kwargs, |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1872 &iterable, &r)) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1873 return NULL; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1874 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1875 pool = PySequence_Tuple(iterable); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1876 if (pool == NULL) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1877 goto error; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1878 n = PyTuple_GET_SIZE(pool); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1879 if (r < 0) { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1880 PyErr_SetString(PyExc_ValueError, "r must be non-negative"); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1881 goto error; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1882 } |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1883 if (r > n) { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1884 PyErr_SetString(PyExc_ValueError, "r cannot be bigger than the iterable"); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1885 goto error; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1886 } |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1887 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1888 indices = PyMem_Malloc(r * sizeof(Py_ssize_t)); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1889 if (indices == NULL) { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1890 PyErr_NoMemory(); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1891 goto error; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1892 } |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1893 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1894 for (i=0 ; i<r ; i++) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1895 indices[i] = i; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1896 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1897 /* create combinationsobject structure */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1898 co = (combinationsobject *)type->tp_alloc(type, 0); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1899 if (co == NULL) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1900 goto error; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1901 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1902 co->pool = pool; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1903 co->indices = indices; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1904 co->result = NULL; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1905 co->r = r; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1906 co->stopped = 0; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1907 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1908 return (PyObject *)co; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1909 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1910 error: |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1911 if (indices != NULL) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1912 PyMem_Free(indices); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1913 Py_XDECREF(pool); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1914 return NULL; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1915 } |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1916 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1917 static void |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1918 combinations_dealloc(combinationsobject *co) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1919 { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1920 PyObject_GC_UnTrack(co); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1921 Py_XDECREF(co->pool); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1922 Py_XDECREF(co->result); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1923 PyMem_Free(co->indices); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1924 Py_TYPE(co)->tp_free(co); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1925 } |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1926 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1927 static int |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1928 combinations_traverse(combinationsobject *co, visitproc visit, void *arg) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1929 { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1930 Py_VISIT(co->pool); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1931 Py_VISIT(co->result); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1932 return 0; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1933 } |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1934 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1935 static PyObject * |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1936 combinations_next(combinationsobject *co) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1937 { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1938 PyObject *elem; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1939 PyObject *oldelem; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1940 PyObject *pool = co->pool; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1941 Py_ssize_t *indices = co->indices; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1942 PyObject *result = co->result; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1943 Py_ssize_t n = PyTuple_GET_SIZE(pool); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1944 Py_ssize_t r = co->r; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1945 Py_ssize_t i, j, index; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1946 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1947 if (co->stopped) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1948 return NULL; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1949 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1950 if (result == NULL) { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1951 /* On the first pass, initialize result tuple using the indices */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1952 result = PyTuple_New(r); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1953 if (result == NULL) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1954 goto empty; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1955 co->result = result; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1956 for (i=0; i<r ; i++) { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1957 index = indices[i]; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1958 elem = PyTuple_GET_ITEM(pool, index); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1959 Py_INCREF(elem); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1960 PyTuple_SET_ITEM(result, i, elem); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1961 } |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1962 } else { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1963 /* Copy the previous result tuple or re-use it if available */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1964 if (Py_REFCNT(result) > 1) { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1965 PyObject *old_result = result; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1966 result = PyTuple_New(r); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1967 if (result == NULL) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1968 goto empty; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1969 co->result = result; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1970 for (i=0; i<r ; i++) { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1971 elem = PyTuple_GET_ITEM(old_result, i); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1972 Py_INCREF(elem); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1973 PyTuple_SET_ITEM(result, i, elem); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1974 } |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1975 Py_DECREF(old_result); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1976 } |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1977 /* Now, we've got the only copy so we can update it in-place |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1978 * CPython's empty tuple is a singleton and cached in |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1979 * PyTuple's freelist. |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1980 */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1981 assert(r == 0 || Py_REFCNT(result) == 1); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1982 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1983 /* Scan indices right-to-left until finding one that is not |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1984 at its maximum (i + n - r). */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1985 for (i=r-1 ; i >= 0 && indices[i] == i+n-r ; i--) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1986 ; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1987 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1988 /* If i is negative, then the indices are all at |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1989 their maximum value and we're done. */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1990 if (i < 0) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1991 goto empty; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1992 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1993 /* Increment the current index which we know is not at its |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1994 maximum. Then move back to the right setting each index |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1995 to its lowest possible value (one higher than the index |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1996 to its left -- this maintains the sort order invariant). */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1997 indices[i]++; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1998 for (j=i+1 ; j<r ; j++) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
1999 indices[j] = indices[j-1] + 1; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2000 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2001 /* Update the result tuple for the new indices |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2002 starting with i, the leftmost index that changed */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2003 for ( ; i<r ; i++) { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2004 index = indices[i]; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2005 elem = PyTuple_GET_ITEM(pool, index); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2006 Py_INCREF(elem); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2007 oldelem = PyTuple_GET_ITEM(result, i); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2008 PyTuple_SET_ITEM(result, i, elem); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2009 Py_DECREF(oldelem); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2010 } |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2011 } |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2012 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2013 Py_INCREF(result); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2014 return result; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2015 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2016 empty: |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2017 co->stopped = 1; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2018 return NULL; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2019 } |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2020 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2021 PyDoc_STRVAR(combinations_doc, |
|
47555
7d824fd131ad
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
Georg Brandl <georg@python.org>
parents:
46238
diff
changeset
|
2022 "combinations(iterable[, r]) --> combinations object\n\ |
|
45548
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2023 \n\ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2024 Return successive r-length combinations of elements in the iterable.\n\n\ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2025 combinations(range(4), 3) --> (0,1,2), (0,1,3), (0,2,3), (1,2,3)"); |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2026 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2027 static PyTypeObject combinations_type = { |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2028 PyVarObject_HEAD_INIT(NULL, 0) |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2029 "itertools.combinations", /* tp_name */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2030 sizeof(combinationsobject), /* tp_basicsize */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2031 0, /* tp_itemsize */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2032 /* methods */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2033 (destructor)combinations_dealloc, /* tp_dealloc */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2034 0, /* tp_print */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2035 0, /* tp_getattr */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2036 0, /* tp_setattr */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2037 0, /* tp_compare */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2038 0, /* tp_repr */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2039 0, /* tp_as_number */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2040 0, /* tp_as_sequence */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2041 0, /* tp_as_mapping */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2042 0, /* tp_hash */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2043 0, /* tp_call */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2044 0, /* tp_str */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2045 PyObject_GenericGetAttr, /* tp_getattro */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2046 0, /* tp_setattro */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2047 0, /* tp_as_buffer */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2048 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2049 Py_TPFLAGS_BASETYPE, /* tp_flags */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2050 combinations_doc, /* tp_doc */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2051 (traverseproc)combinations_traverse, /* tp_traverse */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2052 0, /* tp_clear */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2053 0, /* tp_richcompare */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2054 0, /* tp_weaklistoffset */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2055 PyObject_SelfIter, /* tp_iter */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2056 (iternextfunc)combinations_next, /* tp_iternext */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2057 0, /* tp_methods */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2058 0, /* tp_members */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2059 0, /* tp_getset */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2060 0, /* tp_base */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2061 0, /* tp_dict */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2062 0, /* tp_descr_get */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2063 0, /* tp_descr_set */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2064 0, /* tp_dictoffset */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2065 0, /* tp_init */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2066 0, /* tp_alloc */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2067 combinations_new, /* tp_new */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2068 PyObject_GC_Del, /* tp_free */ |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2069 }; |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2070 |
|
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
2071 |
|
45773
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2072 /* permutations object ************************************************************ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2073 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2074 def permutations(iterable, r=None): |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2075 'permutations(range(3), 2) --> (0,1) (0,2) (1,0) (1,2) (2,0) (2,1)' |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2076 pool = tuple(iterable) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2077 n = len(pool) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2078 r = n if r is None else r |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2079 indices = range(n) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2080 cycles = range(n-r+1, n+1)[::-1] |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2081 yield tuple(pool[i] for i in indices[:r]) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2082 while n: |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2083 for i in reversed(range(r)): |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2084 cycles[i] -= 1 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2085 if cycles[i] == 0: |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2086 indices[i:] = indices[i+1:] + indices[i:i+1] |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2087 cycles[i] = n - i |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2088 else: |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2089 j = cycles[i] |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2090 indices[i], indices[-j] = indices[-j], indices[i] |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2091 yield tuple(pool[i] for i in indices[:r]) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2092 break |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2093 else: |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2094 return |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2095 */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2096 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2097 typedef struct { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2098 PyObject_HEAD |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2099 PyObject *pool; /* input converted to a tuple */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2100 Py_ssize_t *indices; /* one index per element in the pool */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2101 Py_ssize_t *cycles; /* one rollover counter per element in the result */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2102 PyObject *result; /* most recently returned result tuple */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2103 Py_ssize_t r; /* size of result tuple */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2104 int stopped; /* set to 1 when the permutations iterator is exhausted */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2105 } permutationsobject; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2106 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2107 static PyTypeObject permutations_type; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2108 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2109 static PyObject * |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2110 permutations_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2111 { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2112 permutationsobject *po; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2113 Py_ssize_t n; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2114 Py_ssize_t r; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2115 PyObject *robj = Py_None; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2116 PyObject *pool = NULL; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2117 PyObject *iterable = NULL; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2118 Py_ssize_t *indices = NULL; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2119 Py_ssize_t *cycles = NULL; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2120 Py_ssize_t i; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2121 static char *kwargs[] = {"iterable", "r", NULL}; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2122 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2123 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:permutations", kwargs, |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2124 &iterable, &robj)) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2125 return NULL; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2126 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2127 pool = PySequence_Tuple(iterable); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2128 if (pool == NULL) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2129 goto error; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2130 n = PyTuple_GET_SIZE(pool); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2131 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2132 r = n; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2133 if (robj != Py_None) { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2134 if (!PyLong_Check(robj)) { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2135 PyErr_SetString(PyExc_TypeError, "Expected int as r"); |
| 46238 | 2136 goto error; |
|
45773
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2137 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2138 r = PyLong_AsSsize_t(robj); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2139 if (r == -1 && PyErr_Occurred()) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2140 goto error; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2141 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2142 if (r < 0) { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2143 PyErr_SetString(PyExc_ValueError, "r must be non-negative"); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2144 goto error; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2145 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2146 if (r > n) { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2147 PyErr_SetString(PyExc_ValueError, "r cannot be bigger than the iterable"); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2148 goto error; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2149 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2150 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2151 indices = PyMem_Malloc(n * sizeof(Py_ssize_t)); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2152 cycles = PyMem_Malloc(r * sizeof(Py_ssize_t)); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2153 if (indices == NULL || cycles == NULL) { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2154 PyErr_NoMemory(); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2155 goto error; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2156 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2157 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2158 for (i=0 ; i<n ; i++) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2159 indices[i] = i; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2160 for (i=0 ; i<r ; i++) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2161 cycles[i] = n - i; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2162 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2163 /* create permutationsobject structure */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2164 po = (permutationsobject *)type->tp_alloc(type, 0); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2165 if (po == NULL) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2166 goto error; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2167 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2168 po->pool = pool; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2169 po->indices = indices; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2170 po->cycles = cycles; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2171 po->result = NULL; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2172 po->r = r; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2173 po->stopped = 0; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2174 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2175 return (PyObject *)po; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2176 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2177 error: |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2178 if (indices != NULL) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2179 PyMem_Free(indices); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2180 if (cycles != NULL) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2181 PyMem_Free(cycles); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2182 Py_XDECREF(pool); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2183 return NULL; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2184 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2185 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2186 static void |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2187 permutations_dealloc(permutationsobject *po) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2188 { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2189 PyObject_GC_UnTrack(po); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2190 Py_XDECREF(po->pool); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2191 Py_XDECREF(po->result); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2192 PyMem_Free(po->indices); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2193 PyMem_Free(po->cycles); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2194 Py_TYPE(po)->tp_free(po); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2195 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2196 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2197 static int |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2198 permutations_traverse(permutationsobject *po, visitproc visit, void *arg) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2199 { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2200 Py_VISIT(po->pool); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2201 Py_VISIT(po->result); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2202 return 0; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2203 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2204 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2205 static PyObject * |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2206 permutations_next(permutationsobject *po) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2207 { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2208 PyObject *elem; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2209 PyObject *oldelem; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2210 PyObject *pool = po->pool; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2211 Py_ssize_t *indices = po->indices; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2212 Py_ssize_t *cycles = po->cycles; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2213 PyObject *result = po->result; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2214 Py_ssize_t n = PyTuple_GET_SIZE(pool); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2215 Py_ssize_t r = po->r; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2216 Py_ssize_t i, j, k, index; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2217 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2218 if (po->stopped) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2219 return NULL; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2220 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2221 if (result == NULL) { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2222 /* On the first pass, initialize result tuple using the indices */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2223 result = PyTuple_New(r); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2224 if (result == NULL) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2225 goto empty; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2226 po->result = result; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2227 for (i=0; i<r ; i++) { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2228 index = indices[i]; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2229 elem = PyTuple_GET_ITEM(pool, index); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2230 Py_INCREF(elem); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2231 PyTuple_SET_ITEM(result, i, elem); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2232 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2233 } else { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2234 if (n == 0) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2235 goto empty; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2236 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2237 /* Copy the previous result tuple or re-use it if available */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2238 if (Py_REFCNT(result) > 1) { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2239 PyObject *old_result = result; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2240 result = PyTuple_New(r); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2241 if (result == NULL) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2242 goto empty; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2243 po->result = result; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2244 for (i=0; i<r ; i++) { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2245 elem = PyTuple_GET_ITEM(old_result, i); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2246 Py_INCREF(elem); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2247 PyTuple_SET_ITEM(result, i, elem); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2248 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2249 Py_DECREF(old_result); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2250 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2251 /* Now, we've got the only copy so we can update it in-place */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2252 assert(r == 0 || Py_REFCNT(result) == 1); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2253 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2254 /* Decrement rightmost cycle, moving leftward upon zero rollover */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2255 for (i=r-1 ; i>=0 ; i--) { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2256 cycles[i] -= 1; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2257 if (cycles[i] == 0) { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2258 /* rotatation: indices[i:] = indices[i+1:] + indices[i:i+1] */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2259 index = indices[i]; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2260 for (j=i ; j<n-1 ; j++) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2261 indices[j] = indices[j+1]; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2262 indices[n-1] = index; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2263 cycles[i] = n - i; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2264 } else { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2265 j = cycles[i]; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2266 index = indices[i]; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2267 indices[i] = indices[n-j]; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2268 indices[n-j] = index; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2269 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2270 for (k=i; k<r ; k++) { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2271 /* start with i, the leftmost element that changed */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2272 /* yield tuple(pool[k] for k in indices[:r]) */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2273 index = indices[k]; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2274 elem = PyTuple_GET_ITEM(pool, index); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2275 Py_INCREF(elem); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2276 oldelem = PyTuple_GET_ITEM(result, k); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2277 PyTuple_SET_ITEM(result, k, elem); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2278 Py_DECREF(oldelem); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2279 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2280 break; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2281 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2282 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2283 /* If i is negative, then the cycles have all |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2284 rolled-over and we're done. */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2285 if (i < 0) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2286 goto empty; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2287 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2288 Py_INCREF(result); |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2289 return result; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2290 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2291 empty: |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2292 po->stopped = 1; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2293 return NULL; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2294 } |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2295 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2296 PyDoc_STRVAR(permutations_doc, |
|
47555
7d824fd131ad
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
Georg Brandl <georg@python.org>
parents:
46238
diff
changeset
|
2297 "permutations(iterable[, r]) --> permutations object\n\ |
|
45773
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2298 \n\ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2299 Return successive r-length permutations of elements in the iterable.\n\n\ |
|
47555
7d824fd131ad
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
Georg Brandl <georg@python.org>
parents:
46238
diff
changeset
|
2300 permutations(range(3), 2) --> (0,1), (0,2), (1,0), (1,2), (2,0), (2,1)"); |
|
45773
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2301 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2302 static PyTypeObject permutations_type = { |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2303 PyVarObject_HEAD_INIT(NULL, 0) |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2304 "itertools.permutations", /* tp_name */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2305 sizeof(permutationsobject), /* tp_basicsize */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2306 0, /* tp_itemsize */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2307 /* methods */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2308 (destructor)permutations_dealloc, /* tp_dealloc */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2309 0, /* tp_print */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2310 0, /* tp_getattr */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2311 0, /* tp_setattr */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2312 0, /* tp_compare */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2313 0, /* tp_repr */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2314 0, /* tp_as_number */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2315 0, /* tp_as_sequence */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2316 0, /* tp_as_mapping */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2317 0, /* tp_hash */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2318 0, /* tp_call */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2319 0, /* tp_str */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2320 PyObject_GenericGetAttr, /* tp_getattro */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2321 0, /* tp_setattro */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2322 0, /* tp_as_buffer */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2323 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2324 Py_TPFLAGS_BASETYPE, /* tp_flags */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2325 permutations_doc, /* tp_doc */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2326 (traverseproc)permutations_traverse, /* tp_traverse */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2327 0, /* tp_clear */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2328 0, /* tp_richcompare */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2329 0, /* tp_weaklistoffset */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2330 PyObject_SelfIter, /* tp_iter */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2331 (iternextfunc)permutations_next, /* tp_iternext */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2332 0, /* tp_methods */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2333 0, /* tp_members */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2334 0, /* tp_getset */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2335 0, /* tp_base */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2336 0, /* tp_dict */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2337 0, /* tp_descr_get */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2338 0, /* tp_descr_set */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2339 0, /* tp_dictoffset */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2340 0, /* tp_init */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2341 0, /* tp_alloc */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2342 permutations_new, /* tp_new */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2343 PyObject_GC_Del, /* tp_free */ |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2344 }; |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2345 |
|
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
2346 |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2347 /* filterfalse object ************************************************************/ |
| 27769 | 2348 |
| 2349 typedef struct { | |
| 2350 PyObject_HEAD | |
| 2351 PyObject *func; | |
| 2352 PyObject *it; | |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2353 } filterfalseobject; |
| 27769 | 2354 |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2355 static PyTypeObject filterfalse_type; |
| 27769 | 2356 |
| 2357 static PyObject * | |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2358 filterfalse_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
| 27769 | 2359 { |
|
27770
2c389a0448a4
Remove unused variable.
Guido van Rossum <guido@python.org>
parents:
27769
diff
changeset
|
2360 PyObject *func, *seq; |
| 27769 | 2361 PyObject *it; |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2362 filterfalseobject *lz; |
| 27769 | 2363 |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2364 if (type == &filterfalse_type && |
|
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2365 !_PyArg_NoKeywords("filterfalse()", kwds)) |
|
35449
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
2366 return NULL; |
|
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
2367 |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2368 if (!PyArg_UnpackTuple(args, "filterfalse", 2, 2, &func, &seq)) |
| 27769 | 2369 return NULL; |
| 2370 | |
| 2371 /* Get iterator. */ | |
| 2372 it = PyObject_GetIter(seq); | |
| 2373 if (it == NULL) | |
| 2374 return NULL; | |
| 2375 | |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2376 /* create filterfalseobject structure */ |
|
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2377 lz = (filterfalseobject *)type->tp_alloc(type, 0); |
| 27769 | 2378 if (lz == NULL) { |
| 2379 Py_DECREF(it); | |
| 2380 return NULL; | |
| 2381 } | |
| 2382 Py_INCREF(func); | |
| 2383 lz->func = func; | |
| 2384 lz->it = it; | |
| 2385 | |
| 2386 return (PyObject *)lz; | |
| 2387 } | |
| 2388 | |
| 2389 static void | |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2390 filterfalse_dealloc(filterfalseobject *lz) |
| 27769 | 2391 { |
| 2392 PyObject_GC_UnTrack(lz); | |
| 2393 Py_XDECREF(lz->func); | |
| 2394 Py_XDECREF(lz->it); | |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
2395 Py_TYPE(lz)->tp_free(lz); |
| 27769 | 2396 } |
| 2397 | |
| 2398 static int | |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2399 filterfalse_traverse(filterfalseobject *lz, visitproc visit, void *arg) |
| 27769 | 2400 { |
|
32682
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
2401 Py_VISIT(lz->it); |
|
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
2402 Py_VISIT(lz->func); |
| 27769 | 2403 return 0; |
| 2404 } | |
| 2405 | |
| 2406 static PyObject * | |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2407 filterfalse_next(filterfalseobject *lz) |
| 27769 | 2408 { |
| 2409 PyObject *item; | |
|
28117
9b4eed4bb3e2
Several of the tools can make direct calls the inner iterators.
Raymond Hettinger <python@rcn.com>
parents:
28024
diff
changeset
|
2410 PyObject *it = lz->it; |
| 27769 | 2411 long ok; |
|
31675
f7374e3b279a
Speedup the inner loops for dropwhile(), islice(), ifilter(), and
Raymond Hettinger <python@rcn.com>
parents:
31508
diff
changeset
|
2412 PyObject *(*iternext)(PyObject *); |
| 27769 | 2413 |
|
31675
f7374e3b279a
Speedup the inner loops for dropwhile(), islice(), ifilter(), and
Raymond Hettinger <python@rcn.com>
parents:
31508
diff
changeset
|
2414 assert(PyIter_Check(it)); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
2415 iternext = *Py_TYPE(it)->tp_iternext; |
| 27769 | 2416 for (;;) { |
|
31675
f7374e3b279a
Speedup the inner loops for dropwhile(), islice(), ifilter(), and
Raymond Hettinger <python@rcn.com>
parents:
31508
diff
changeset
|
2417 item = iternext(it); |
| 27769 | 2418 if (item == NULL) |
| 2419 return NULL; | |
| 2420 | |
|
45534
7afef8f43e4a
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61064,61066-61080 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45446
diff
changeset
|
2421 if (lz->func == Py_None || lz->func == (PyObject *)&PyBool_Type) { |
| 27769 | 2422 ok = PyObject_IsTrue(item); |
| 2423 } else { | |
| 2424 PyObject *good; | |
| 2425 good = PyObject_CallFunctionObjArgs(lz->func, | |
| 2426 item, NULL); | |
| 2427 if (good == NULL) { | |
| 2428 Py_DECREF(item); | |
| 2429 return NULL; | |
| 2430 } | |
| 2431 ok = PyObject_IsTrue(good); | |
| 2432 Py_DECREF(good); | |
| 2433 } | |
| 2434 if (!ok) | |
| 2435 return item; | |
| 2436 Py_DECREF(item); | |
| 2437 } | |
| 2438 } | |
| 2439 | |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2440 PyDoc_STRVAR(filterfalse_doc, |
|
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2441 "filterfalse(function or None, sequence) --> filterfalse object\n\ |
| 27769 | 2442 \n\ |
| 2443 Return those items of sequence for which function(item) is false.\n\ | |
| 2444 If function is None, return the items that are false."); | |
| 2445 | |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2446 static PyTypeObject filterfalse_type = { |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
2447 PyVarObject_HEAD_INIT(NULL, 0) |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2448 "itertools.filterfalse", /* tp_name */ |
|
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2449 sizeof(filterfalseobject), /* tp_basicsize */ |
| 27769 | 2450 0, /* tp_itemsize */ |
| 2451 /* methods */ | |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2452 (destructor)filterfalse_dealloc, /* tp_dealloc */ |
| 27769 | 2453 0, /* tp_print */ |
| 2454 0, /* tp_getattr */ | |
| 2455 0, /* tp_setattr */ | |
| 2456 0, /* tp_compare */ | |
| 2457 0, /* tp_repr */ | |
| 2458 0, /* tp_as_number */ | |
| 2459 0, /* tp_as_sequence */ | |
| 2460 0, /* tp_as_mapping */ | |
| 2461 0, /* tp_hash */ | |
| 2462 0, /* tp_call */ | |
| 2463 0, /* tp_str */ | |
| 2464 PyObject_GenericGetAttr, /* tp_getattro */ | |
| 2465 0, /* tp_setattro */ | |
| 2466 0, /* tp_as_buffer */ | |
| 2467 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | | |
| 2468 Py_TPFLAGS_BASETYPE, /* tp_flags */ | |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2469 filterfalse_doc, /* tp_doc */ |
|
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2470 (traverseproc)filterfalse_traverse, /* tp_traverse */ |
| 27769 | 2471 0, /* tp_clear */ |
| 2472 0, /* tp_richcompare */ | |
| 2473 0, /* tp_weaklistoffset */ | |
|
28320
fd5ef7003469
Renamed PyObject_GenericGetIter to PyObject_SelfIter
Raymond Hettinger <python@rcn.com>
parents:
28308
diff
changeset
|
2474 PyObject_SelfIter, /* tp_iter */ |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2475 (iternextfunc)filterfalse_next, /* tp_iternext */ |
| 27769 | 2476 0, /* tp_methods */ |
| 2477 0, /* tp_members */ | |
| 2478 0, /* tp_getset */ | |
| 2479 0, /* tp_base */ | |
| 2480 0, /* tp_dict */ | |
| 2481 0, /* tp_descr_get */ | |
| 2482 0, /* tp_descr_set */ | |
| 2483 0, /* tp_dictoffset */ | |
| 2484 0, /* tp_init */ | |
|
29242
d72ad07c739e
PyType_GenericAlloc is inherited from object.
Raymond Hettinger <python@rcn.com>
parents:
29225
diff
changeset
|
2485 0, /* tp_alloc */ |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2486 filterfalse_new, /* tp_new */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2487 PyObject_GC_Del, /* tp_free */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2488 }; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2489 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2490 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2491 /* count object ************************************************************/ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2492 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2493 typedef struct { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2494 PyObject_HEAD |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
2495 Py_ssize_t cnt; |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2496 PyObject *long_cnt; /* Arbitrarily large count when cnt >= PY_SSIZE_T_MAX */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2497 } countobject; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2498 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
2499 static PyTypeObject count_type; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2500 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2501 static PyObject * |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2502 count_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2503 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2504 countobject *lz; |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
2505 Py_ssize_t cnt = 0; |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2506 PyObject *cnt_arg = NULL; |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2507 PyObject *long_cnt = NULL; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2508 |
|
40737
6ebad2a6b990
Merged revisions 53451-53537 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40450
diff
changeset
|
2509 if (type == &count_type && !_PyArg_NoKeywords("count()", kwds)) |
|
35449
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
2510 return NULL; |
|
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
2511 |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2512 if (!PyArg_UnpackTuple(args, "count", 0, 1, &cnt_arg)) |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2513 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2514 |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2515 if (cnt_arg != NULL) { |
|
44099
f324631462a2
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
Christian Heimes <christian@cheimes.de>
parents:
43734
diff
changeset
|
2516 cnt = PyLong_AsSsize_t(cnt_arg); |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2517 if (cnt == -1 && PyErr_Occurred()) { |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2518 PyErr_Clear(); |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2519 if (!PyLong_Check(cnt_arg)) { |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2520 PyErr_SetString(PyExc_TypeError, "an integer is required"); |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2521 return NULL; |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2522 } |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2523 long_cnt = cnt_arg; |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2524 Py_INCREF(long_cnt); |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2525 cnt = PY_SSIZE_T_MAX; |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2526 } |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2527 } |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2528 |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2529 /* create countobject structure */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2530 lz = (countobject *)PyObject_New(countobject, &count_type); |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2531 if (lz == NULL) { |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2532 Py_XDECREF(long_cnt); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2533 return NULL; |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2534 } |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2535 lz->cnt = cnt; |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2536 lz->long_cnt = long_cnt; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2537 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2538 return (PyObject *)lz; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2539 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2540 |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2541 static void |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2542 count_dealloc(countobject *lz) |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2543 { |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2544 Py_XDECREF(lz->long_cnt); |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2545 PyObject_Del(lz); |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2546 } |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2547 |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2548 static PyObject * |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2549 count_nextlong(countobject *lz) |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2550 { |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2551 static PyObject *one = NULL; |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2552 PyObject *cnt; |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2553 PyObject *stepped_up; |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2554 |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2555 if (lz->long_cnt == NULL) { |
|
44099
f324631462a2
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
Christian Heimes <christian@cheimes.de>
parents:
43734
diff
changeset
|
2556 lz->long_cnt = PyLong_FromSsize_t(PY_SSIZE_T_MAX); |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2557 if (lz->long_cnt == NULL) |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2558 return NULL; |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2559 } |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2560 if (one == NULL) { |
|
44099
f324631462a2
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
Christian Heimes <christian@cheimes.de>
parents:
43734
diff
changeset
|
2561 one = PyLong_FromLong(1); |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2562 if (one == NULL) |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2563 return NULL; |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2564 } |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2565 cnt = lz->long_cnt; |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2566 assert(cnt != NULL); |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2567 stepped_up = PyNumber_Add(cnt, one); |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2568 if (stepped_up == NULL) |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2569 return NULL; |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2570 lz->long_cnt = stepped_up; |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2571 return cnt; |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2572 } |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2573 |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2574 static PyObject * |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2575 count_next(countobject *lz) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2576 { |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2577 if (lz->cnt == PY_SSIZE_T_MAX) |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2578 return count_nextlong(lz); |
|
44099
f324631462a2
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
Christian Heimes <christian@cheimes.de>
parents:
43734
diff
changeset
|
2579 return PyLong_FromSsize_t(lz->cnt++); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2580 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2581 |
|
31890
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2582 static PyObject * |
|
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2583 count_repr(countobject *lz) |
|
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2584 { |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2585 if (lz->cnt != PY_SSIZE_T_MAX) |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2586 return PyUnicode_FromFormat("count(%zd)", lz->cnt); |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2587 |
|
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2588 return PyUnicode_FromFormat("count(%R)", lz->long_cnt); |
|
31890
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2589 } |
|
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2590 |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2591 PyDoc_STRVAR(count_doc, |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2592 "count([firstval]) --> count object\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2593 \n\ |
|
41501
0c5019afc55b
PEP 3114: rename .next() to .__next__() and add next() builtin.
Georg Brandl <georg@python.org>
parents:
40893
diff
changeset
|
2594 Return a count object whose .__next__() method returns consecutive\n\ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2595 integers starting from zero or, if specified, from firstval."); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2596 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
2597 static PyTypeObject count_type = { |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
2598 PyVarObject_HEAD_INIT(NULL, 0) |
| 27769 | 2599 "itertools.count", /* tp_name */ |
| 2600 sizeof(countobject), /* tp_basicsize */ | |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2601 0, /* tp_itemsize */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2602 /* methods */ |
|
43734
3e5edf19d5f0
Merged revisions 58221-58741 via svnmerge from
Guido van Rossum <guido@python.org>
parents:
42334
diff
changeset
|
2603 (destructor)count_dealloc, /* tp_dealloc */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2604 0, /* tp_print */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2605 0, /* tp_getattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2606 0, /* tp_setattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2607 0, /* tp_compare */ |
|
31890
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2608 (reprfunc)count_repr, /* tp_repr */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2609 0, /* tp_as_number */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2610 0, /* tp_as_sequence */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2611 0, /* tp_as_mapping */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2612 0, /* tp_hash */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2613 0, /* tp_call */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2614 0, /* tp_str */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2615 PyObject_GenericGetAttr, /* tp_getattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2616 0, /* tp_setattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2617 0, /* tp_as_buffer */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2618 Py_TPFLAGS_DEFAULT, /* tp_flags */ |
| 27769 | 2619 count_doc, /* tp_doc */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2620 0, /* tp_traverse */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2621 0, /* tp_clear */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2622 0, /* tp_richcompare */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2623 0, /* tp_weaklistoffset */ |
|
28320
fd5ef7003469
Renamed PyObject_GenericGetIter to PyObject_SelfIter
Raymond Hettinger <python@rcn.com>
parents:
28308
diff
changeset
|
2624 PyObject_SelfIter, /* tp_iter */ |
| 27769 | 2625 (iternextfunc)count_next, /* tp_iternext */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2626 0, /* tp_methods */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2627 0, /* tp_members */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2628 0, /* tp_getset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2629 0, /* tp_base */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2630 0, /* tp_dict */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2631 0, /* tp_descr_get */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2632 0, /* tp_descr_set */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2633 0, /* tp_dictoffset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2634 0, /* tp_init */ |
|
29242
d72ad07c739e
PyType_GenericAlloc is inherited from object.
Raymond Hettinger <python@rcn.com>
parents:
29225
diff
changeset
|
2635 0, /* tp_alloc */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2636 count_new, /* tp_new */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2637 }; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2638 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2639 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2640 /* repeat object ************************************************************/ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2641 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2642 typedef struct { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2643 PyObject_HEAD |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2644 PyObject *element; |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
2645 Py_ssize_t cnt; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2646 } repeatobject; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2647 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
2648 static PyTypeObject repeat_type; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2649 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2650 static PyObject * |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2651 repeat_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2652 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2653 repeatobject *ro; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2654 PyObject *element; |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
2655 Py_ssize_t cnt = -1; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2656 |
|
40737
6ebad2a6b990
Merged revisions 53451-53537 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40450
diff
changeset
|
2657 if (type == &repeat_type && !_PyArg_NoKeywords("repeat()", kwds)) |
|
35449
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
2658 return NULL; |
|
1fdfd0130e28
Disallow keyword arguments for type constructors that don't use them.
Georg Brandl <georg@python.org>
parents:
34108
diff
changeset
|
2659 |
|
38453
29ae5e0fc348
Much-needed merge (using svnmerge.py this time) of trunk changes into p3yk.
Thomas Wouters <thomas@python.org>
parents:
37879
diff
changeset
|
2660 if (!PyArg_ParseTuple(args, "O|n:repeat", &element, &cnt)) |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2661 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2662 |
|
28945
001a90555780
* Added a substantial number of edge case and argument tests for
Raymond Hettinger <python@rcn.com>
parents:
28930
diff
changeset
|
2663 if (PyTuple_Size(args) == 2 && cnt < 0) |
|
001a90555780
* Added a substantial number of edge case and argument tests for
Raymond Hettinger <python@rcn.com>
parents:
28930
diff
changeset
|
2664 cnt = 0; |
|
001a90555780
* Added a substantial number of edge case and argument tests for
Raymond Hettinger <python@rcn.com>
parents:
28930
diff
changeset
|
2665 |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2666 ro = (repeatobject *)type->tp_alloc(type, 0); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2667 if (ro == NULL) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2668 return NULL; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2669 Py_INCREF(element); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2670 ro->element = element; |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
2671 ro->cnt = cnt; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2672 return (PyObject *)ro; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2673 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2674 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2675 static void |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2676 repeat_dealloc(repeatobject *ro) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2677 { |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2678 PyObject_GC_UnTrack(ro); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2679 Py_XDECREF(ro->element); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
2680 Py_TYPE(ro)->tp_free(ro); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2681 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2682 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2683 static int |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2684 repeat_traverse(repeatobject *ro, visitproc visit, void *arg) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2685 { |
|
32682
bc4dd31c73fd
Exercise Jim's VISIT macro.
Raymond Hettinger <python@rcn.com>
parents:
32010
diff
changeset
|
2686 Py_VISIT(ro->element); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2687 return 0; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2688 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2689 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2690 static PyObject * |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2691 repeat_next(repeatobject *ro) |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2692 { |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
2693 if (ro->cnt == 0) |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
2694 return NULL; |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
2695 if (ro->cnt > 0) |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
2696 ro->cnt--; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2697 Py_INCREF(ro->element); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2698 return ro->element; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2699 } |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2700 |
|
31890
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2701 static PyObject * |
|
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2702 repeat_repr(repeatobject *ro) |
|
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2703 { |
|
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2704 if (ro->cnt == -1) |
|
41782
bee8d01ef42c
Add a format specifier %R to PyUnicode_FromFormat(), which embeds
Walter Dörwald <walter@livinglogic.de>
parents:
41769
diff
changeset
|
2705 return PyUnicode_FromFormat("repeat(%R)", ro->element); |
|
31890
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2706 else |
|
41782
bee8d01ef42c
Add a format specifier %R to PyUnicode_FromFormat(), which embeds
Walter Dörwald <walter@livinglogic.de>
parents:
41769
diff
changeset
|
2707 return PyUnicode_FromFormat("repeat(%R, %zd)", ro->element, ro->cnt); |
|
31890
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2708 } |
|
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2709 |
|
35636
e22334b1da67
Convert iterator __len__() methods to a private API.
Raymond Hettinger <python@rcn.com>
parents:
35449
diff
changeset
|
2710 static PyObject * |
|
31501
14f860b03be2
Give itertools.repeat() a length method.
Raymond Hettinger <python@rcn.com>
parents:
31136
diff
changeset
|
2711 repeat_len(repeatobject *ro) |
|
14f860b03be2
Give itertools.repeat() a length method.
Raymond Hettinger <python@rcn.com>
parents:
31136
diff
changeset
|
2712 { |
|
35636
e22334b1da67
Convert iterator __len__() methods to a private API.
Raymond Hettinger <python@rcn.com>
parents:
35449
diff
changeset
|
2713 if (ro->cnt == -1) { |
|
31501
14f860b03be2
Give itertools.repeat() a length method.
Raymond Hettinger <python@rcn.com>
parents:
31136
diff
changeset
|
2714 PyErr_SetString(PyExc_TypeError, "len() of unsized object"); |
|
35636
e22334b1da67
Convert iterator __len__() methods to a private API.
Raymond Hettinger <python@rcn.com>
parents:
35449
diff
changeset
|
2715 return NULL; |
|
e22334b1da67
Convert iterator __len__() methods to a private API.
Raymond Hettinger <python@rcn.com>
parents:
35449
diff
changeset
|
2716 } |
|
44099
f324631462a2
Cleanup: Replaced most PyInt_ aliases with PyLong_ and disabled the aliases in intobject.h
Christian Heimes <christian@cheimes.de>
parents:
43734
diff
changeset
|
2717 return PyLong_FromSize_t(ro->cnt); |
|
31501
14f860b03be2
Give itertools.repeat() a length method.
Raymond Hettinger <python@rcn.com>
parents:
31136
diff
changeset
|
2718 } |
|
14f860b03be2
Give itertools.repeat() a length method.
Raymond Hettinger <python@rcn.com>
parents:
31136
diff
changeset
|
2719 |
|
36484
20f75d5e79e9
Renamed _length_cue() to __length_hint__(). See:
Armin Rigo <arigo@tunes.org>
parents:
36324
diff
changeset
|
2720 PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); |
|
35636
e22334b1da67
Convert iterator __len__() methods to a private API.
Raymond Hettinger <python@rcn.com>
parents:
35449
diff
changeset
|
2721 |
|
e22334b1da67
Convert iterator __len__() methods to a private API.
Raymond Hettinger <python@rcn.com>
parents:
35449
diff
changeset
|
2722 static PyMethodDef repeat_methods[] = { |
|
36484
20f75d5e79e9
Renamed _length_cue() to __length_hint__(). See:
Armin Rigo <arigo@tunes.org>
parents:
36324
diff
changeset
|
2723 {"__length_hint__", (PyCFunction)repeat_len, METH_NOARGS, length_hint_doc}, |
|
35636
e22334b1da67
Convert iterator __len__() methods to a private API.
Raymond Hettinger <python@rcn.com>
parents:
35449
diff
changeset
|
2724 {NULL, NULL} /* sentinel */ |
|
31501
14f860b03be2
Give itertools.repeat() a length method.
Raymond Hettinger <python@rcn.com>
parents:
31136
diff
changeset
|
2725 }; |
|
14f860b03be2
Give itertools.repeat() a length method.
Raymond Hettinger <python@rcn.com>
parents:
31136
diff
changeset
|
2726 |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2727 PyDoc_STRVAR(repeat_doc, |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
2728 "repeat(element [,times]) -> create an iterator which returns the element\n\ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
2729 for the specified number of times. If not specified, returns the element\n\ |
|
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
2730 endlessly."); |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2731 |
|
29850
45dc33433323
SF patch #770521: make itertools type declarations static
Raymond Hettinger <python@rcn.com>
parents:
29535
diff
changeset
|
2732 static PyTypeObject repeat_type = { |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
2733 PyVarObject_HEAD_INIT(NULL, 0) |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2734 "itertools.repeat", /* tp_name */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2735 sizeof(repeatobject), /* tp_basicsize */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2736 0, /* tp_itemsize */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2737 /* methods */ |
| 27769 | 2738 (destructor)repeat_dealloc, /* tp_dealloc */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2739 0, /* tp_print */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2740 0, /* tp_getattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2741 0, /* tp_setattr */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2742 0, /* tp_compare */ |
|
31890
848bce2215d3
Provide more information representations of repeat() and count().
Raymond Hettinger <python@rcn.com>
parents:
31675
diff
changeset
|
2743 (reprfunc)repeat_repr, /* tp_repr */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2744 0, /* tp_as_number */ |
|
35636
e22334b1da67
Convert iterator __len__() methods to a private API.
Raymond Hettinger <python@rcn.com>
parents:
35449
diff
changeset
|
2745 0, /* tp_as_sequence */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2746 0, /* tp_as_mapping */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2747 0, /* tp_hash */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2748 0, /* tp_call */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2749 0, /* tp_str */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2750 PyObject_GenericGetAttr, /* tp_getattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2751 0, /* tp_setattro */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2752 0, /* tp_as_buffer */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2753 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2754 Py_TPFLAGS_BASETYPE, /* tp_flags */ |
| 27769 | 2755 repeat_doc, /* tp_doc */ |
| 2756 (traverseproc)repeat_traverse, /* tp_traverse */ | |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2757 0, /* tp_clear */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2758 0, /* tp_richcompare */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2759 0, /* tp_weaklistoffset */ |
|
28320
fd5ef7003469
Renamed PyObject_GenericGetIter to PyObject_SelfIter
Raymond Hettinger <python@rcn.com>
parents:
28308
diff
changeset
|
2760 PyObject_SelfIter, /* tp_iter */ |
| 27769 | 2761 (iternextfunc)repeat_next, /* tp_iternext */ |
|
35636
e22334b1da67
Convert iterator __len__() methods to a private API.
Raymond Hettinger <python@rcn.com>
parents:
35449
diff
changeset
|
2762 repeat_methods, /* tp_methods */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2763 0, /* tp_members */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2764 0, /* tp_getset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2765 0, /* tp_base */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2766 0, /* tp_dict */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2767 0, /* tp_descr_get */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2768 0, /* tp_descr_set */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2769 0, /* tp_dictoffset */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2770 0, /* tp_init */ |
|
29242
d72ad07c739e
PyType_GenericAlloc is inherited from object.
Raymond Hettinger <python@rcn.com>
parents:
29225
diff
changeset
|
2771 0, /* tp_alloc */ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2772 repeat_new, /* tp_new */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2773 PyObject_GC_Del, /* tp_free */ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2774 }; |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
2775 |
|
45738
740b5808c57a
Move itertools izip() code to builtins as zip(). Complete the renaming.
Raymond Hettinger <python@rcn.com>
parents:
45736
diff
changeset
|
2776 /* ziplongest object ************************************************************/ |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2777 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2778 #include "Python.h" |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2779 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2780 typedef struct { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2781 PyObject_HEAD |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2782 Py_ssize_t tuplesize; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2783 Py_ssize_t numactive; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2784 PyObject *ittuple; /* tuple of iterators */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2785 PyObject *result; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2786 PyObject *fillvalue; |
|
45738
740b5808c57a
Move itertools izip() code to builtins as zip(). Complete the renaming.
Raymond Hettinger <python@rcn.com>
parents:
45736
diff
changeset
|
2787 } ziplongestobject; |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2788 |
|
45738
740b5808c57a
Move itertools izip() code to builtins as zip(). Complete the renaming.
Raymond Hettinger <python@rcn.com>
parents:
45736
diff
changeset
|
2789 static PyTypeObject ziplongest_type; |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2790 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2791 static PyObject * |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2792 zip_longest_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2793 { |
|
45738
740b5808c57a
Move itertools izip() code to builtins as zip(). Complete the renaming.
Raymond Hettinger <python@rcn.com>
parents:
45736
diff
changeset
|
2794 ziplongestobject *lz; |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2795 Py_ssize_t i; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2796 PyObject *ittuple; /* tuple of iterators */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2797 PyObject *result; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2798 PyObject *fillvalue = Py_None; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2799 Py_ssize_t tuplesize = PySequence_Length(args); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2800 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2801 if (kwds != NULL && PyDict_CheckExact(kwds) && PyDict_Size(kwds) > 0) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2802 fillvalue = PyDict_GetItemString(kwds, "fillvalue"); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2803 if (fillvalue == NULL || PyDict_Size(kwds) > 1) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2804 PyErr_SetString(PyExc_TypeError, |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2805 "zip_longest() got an unexpected keyword argument"); |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2806 return NULL; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2807 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2808 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2809 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2810 /* args must be a tuple */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2811 assert(PyTuple_Check(args)); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2812 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2813 /* obtain iterators */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2814 ittuple = PyTuple_New(tuplesize); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2815 if (ittuple == NULL) |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2816 return NULL; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2817 for (i=0; i < tuplesize; ++i) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2818 PyObject *item = PyTuple_GET_ITEM(args, i); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2819 PyObject *it = PyObject_GetIter(item); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2820 if (it == NULL) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2821 if (PyErr_ExceptionMatches(PyExc_TypeError)) |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2822 PyErr_Format(PyExc_TypeError, |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2823 "zip_longest argument #%zd must support iteration", |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2824 i+1); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2825 Py_DECREF(ittuple); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2826 return NULL; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2827 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2828 PyTuple_SET_ITEM(ittuple, i, it); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2829 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2830 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2831 /* create a result holder */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2832 result = PyTuple_New(tuplesize); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2833 if (result == NULL) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2834 Py_DECREF(ittuple); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2835 return NULL; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2836 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2837 for (i=0 ; i < tuplesize ; i++) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2838 Py_INCREF(Py_None); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2839 PyTuple_SET_ITEM(result, i, Py_None); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2840 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2841 |
|
45738
740b5808c57a
Move itertools izip() code to builtins as zip(). Complete the renaming.
Raymond Hettinger <python@rcn.com>
parents:
45736
diff
changeset
|
2842 /* create ziplongestobject structure */ |
|
740b5808c57a
Move itertools izip() code to builtins as zip(). Complete the renaming.
Raymond Hettinger <python@rcn.com>
parents:
45736
diff
changeset
|
2843 lz = (ziplongestobject *)type->tp_alloc(type, 0); |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2844 if (lz == NULL) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2845 Py_DECREF(ittuple); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2846 Py_DECREF(result); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2847 return NULL; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2848 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2849 lz->ittuple = ittuple; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2850 lz->tuplesize = tuplesize; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2851 lz->numactive = tuplesize; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2852 lz->result = result; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2853 Py_INCREF(fillvalue); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2854 lz->fillvalue = fillvalue; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2855 return (PyObject *)lz; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2856 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2857 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2858 static void |
|
45738
740b5808c57a
Move itertools izip() code to builtins as zip(). Complete the renaming.
Raymond Hettinger <python@rcn.com>
parents:
45736
diff
changeset
|
2859 zip_longest_dealloc(ziplongestobject *lz) |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2860 { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2861 PyObject_GC_UnTrack(lz); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2862 Py_XDECREF(lz->ittuple); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2863 Py_XDECREF(lz->result); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2864 Py_XDECREF(lz->fillvalue); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
2865 Py_TYPE(lz)->tp_free(lz); |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2866 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2867 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2868 static int |
|
45738
740b5808c57a
Move itertools izip() code to builtins as zip(). Complete the renaming.
Raymond Hettinger <python@rcn.com>
parents:
45736
diff
changeset
|
2869 zip_longest_traverse(ziplongestobject *lz, visitproc visit, void *arg) |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2870 { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2871 Py_VISIT(lz->ittuple); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2872 Py_VISIT(lz->result); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2873 Py_VISIT(lz->fillvalue); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2874 return 0; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2875 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2876 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2877 static PyObject * |
|
45738
740b5808c57a
Move itertools izip() code to builtins as zip(). Complete the renaming.
Raymond Hettinger <python@rcn.com>
parents:
45736
diff
changeset
|
2878 zip_longest_next(ziplongestobject *lz) |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2879 { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2880 Py_ssize_t i; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2881 Py_ssize_t tuplesize = lz->tuplesize; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2882 PyObject *result = lz->result; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2883 PyObject *it; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2884 PyObject *item; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2885 PyObject *olditem; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2886 |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2887 if (tuplesize == 0) |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2888 return NULL; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2889 if (lz->numactive == 0) |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2890 return NULL; |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
2891 if (Py_REFCNT(result) == 1) { |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2892 Py_INCREF(result); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2893 for (i=0 ; i < tuplesize ; i++) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2894 it = PyTuple_GET_ITEM(lz->ittuple, i); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2895 if (it == NULL) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2896 Py_INCREF(lz->fillvalue); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2897 item = lz->fillvalue; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2898 } else { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2899 assert(PyIter_Check(it)); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
2900 item = (*Py_TYPE(it)->tp_iternext)(it); |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2901 if (item == NULL) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2902 lz->numactive -= 1; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2903 if (lz->numactive == 0) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2904 Py_DECREF(result); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2905 return NULL; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2906 } else { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2907 Py_INCREF(lz->fillvalue); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2908 item = lz->fillvalue; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2909 PyTuple_SET_ITEM(lz->ittuple, i, NULL); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2910 Py_DECREF(it); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2911 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2912 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2913 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2914 olditem = PyTuple_GET_ITEM(result, i); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2915 PyTuple_SET_ITEM(result, i, item); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2916 Py_DECREF(olditem); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2917 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2918 } else { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2919 result = PyTuple_New(tuplesize); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2920 if (result == NULL) |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2921 return NULL; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2922 for (i=0 ; i < tuplesize ; i++) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2923 it = PyTuple_GET_ITEM(lz->ittuple, i); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2924 if (it == NULL) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2925 Py_INCREF(lz->fillvalue); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2926 item = lz->fillvalue; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2927 } else { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2928 assert(PyIter_Check(it)); |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
2929 item = (*Py_TYPE(it)->tp_iternext)(it); |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2930 if (item == NULL) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2931 lz->numactive -= 1; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2932 if (lz->numactive == 0) { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2933 Py_DECREF(result); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2934 return NULL; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2935 } else { |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2936 Py_INCREF(lz->fillvalue); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2937 item = lz->fillvalue; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2938 PyTuple_SET_ITEM(lz->ittuple, i, NULL); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2939 Py_DECREF(it); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2940 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2941 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2942 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2943 PyTuple_SET_ITEM(result, i, item); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2944 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2945 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2946 return result; |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2947 } |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2948 |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2949 PyDoc_STRVAR(zip_longest_doc, |
|
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2950 "zip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --> zip_longest object\n\ |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2951 \n\ |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2952 Return an zip_longest object whose .__next__() method returns a tuple where\n\ |
|
41501
0c5019afc55b
PEP 3114: rename .next() to .__next__() and add next() builtin.
Georg Brandl <georg@python.org>
parents:
40893
diff
changeset
|
2953 the i-th element comes from the i-th iterable argument. The .__next__()\n\ |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2954 method continues until the longest iterable in the argument sequence\n\ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2955 is exhausted and then it raises StopIteration. When the shorter iterables\n\ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2956 are exhausted, the fillvalue is substituted in their place. The fillvalue\n\ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2957 defaults to None or can be specified by a keyword argument.\n\ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2958 "); |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2959 |
|
45738
740b5808c57a
Move itertools izip() code to builtins as zip(). Complete the renaming.
Raymond Hettinger <python@rcn.com>
parents:
45736
diff
changeset
|
2960 static PyTypeObject ziplongest_type = { |
|
42334
e70cdce0e8b2
Merged revisions 56467-56482 via svnmerge from
Martin v. Löwis <martin@v.loewis.de>
parents:
41782
diff
changeset
|
2961 PyVarObject_HEAD_INIT(NULL, 0) |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2962 "itertools.zip_longest", /* tp_name */ |
|
45738
740b5808c57a
Move itertools izip() code to builtins as zip(). Complete the renaming.
Raymond Hettinger <python@rcn.com>
parents:
45736
diff
changeset
|
2963 sizeof(ziplongestobject), /* tp_basicsize */ |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2964 0, /* tp_itemsize */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2965 /* methods */ |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2966 (destructor)zip_longest_dealloc, /* tp_dealloc */ |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2967 0, /* tp_print */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2968 0, /* tp_getattr */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2969 0, /* tp_setattr */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2970 0, /* tp_compare */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2971 0, /* tp_repr */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2972 0, /* tp_as_number */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2973 0, /* tp_as_sequence */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2974 0, /* tp_as_mapping */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2975 0, /* tp_hash */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2976 0, /* tp_call */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2977 0, /* tp_str */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2978 PyObject_GenericGetAttr, /* tp_getattro */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2979 0, /* tp_setattro */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2980 0, /* tp_as_buffer */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2981 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2982 Py_TPFLAGS_BASETYPE, /* tp_flags */ |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2983 zip_longest_doc, /* tp_doc */ |
|
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2984 (traverseproc)zip_longest_traverse, /* tp_traverse */ |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2985 0, /* tp_clear */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2986 0, /* tp_richcompare */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2987 0, /* tp_weaklistoffset */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2988 PyObject_SelfIter, /* tp_iter */ |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
2989 (iternextfunc)zip_longest_next, /* tp_iternext */ |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2990 0, /* tp_methods */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2991 0, /* tp_members */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2992 0, /* tp_getset */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2993 0, /* tp_base */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2994 0, /* tp_dict */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2995 0, /* tp_descr_get */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2996 0, /* tp_descr_set */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2997 0, /* tp_dictoffset */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2998 0, /* tp_init */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
2999 0, /* tp_alloc */ |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
3000 zip_longest_new, /* tp_new */ |
|
40893
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
3001 PyObject_GC_Del, /* tp_free */ |
|
32c4897b5d46
Merged revisions 53623-53858 via svnmerge from
Thomas Wouters <thomas@python.org>
parents:
40737
diff
changeset
|
3002 }; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3003 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3004 /* module level code ********************************************************/ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3005 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3006 PyDoc_STRVAR(module_doc, |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3007 "Functional tools for creating and using iterators.\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3008 \n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3009 Infinite iterators:\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3010 count([n]) --> n, n+1, n+2, ...\n\ |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
3011 cycle(p) --> p0, p1, ... plast, p0, p1, ...\n\ |
| 28601 | 3012 repeat(elem [,n]) --> elem, elem, elem, ... endlessly or up to n times\n\ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3013 \n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3014 Iterators terminating on the shortest input sequence:\n\ |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
3015 zip_longest(p, q, ...) --> (p[0], q[0]), (p[1], q[1]), ... \n\ |
|
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
3016 filterfalse(pred, seq) --> elements of seq where pred(elem) is False\n\ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3017 islice(seq, [start,] stop [, step]) --> elements from\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3018 seq[start:stop:step]\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3019 starmap(fun, seq) --> fun(*seq[0]), fun(*seq[1]), ...\n\ |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
3020 tee(it, n=2) --> (it1, it2 , ... itn) splits one iterator into n\n\ |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
3021 chain(p, q, ...) --> p0, p1, ... plast, q0, q1, ... \n\ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3022 takewhile(pred, seq) --> seq[0], seq[1], until pred fails\n\ |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3023 dropwhile(pred, seq) --> seq[n], seq[n+1], starting when pred fails\n\ |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
3024 groupby(iterable[, keyfunc]) --> sub-iterators grouped by value of keyfunc(v)\n\ |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3025 "); |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3026 |
|
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3027 |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
3028 static PyMethodDef module_methods[] = { |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
3029 {"tee", (PyCFunction)tee, METH_VARARGS, tee_doc}, |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
3030 {NULL, NULL} /* sentinel */ |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
3031 }; |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
3032 |
|
47580
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3033 |
|
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3034 static struct PyModuleDef itertoolsmodule = { |
|
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3035 PyModuleDef_HEAD_INIT, |
|
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3036 "itertools", |
|
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3037 module_doc, |
|
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3038 -1, |
|
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3039 module_methods, |
|
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3040 NULL, |
|
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3041 NULL, |
|
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3042 NULL, |
|
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3043 NULL |
|
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3044 }; |
|
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3045 |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3046 PyMODINIT_FUNC |
|
47580
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3047 PyInit_itertools(void) |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3048 { |
| 27769 | 3049 int i; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3050 PyObject *m; |
| 27769 | 3051 char *name; |
| 3052 PyTypeObject *typelist[] = { | |
|
45548
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
3053 &combinations_type, |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
3054 &cycle_type, |
| 27769 | 3055 &dropwhile_type, |
| 3056 &takewhile_type, | |
| 3057 &islice_type, | |
| 3058 &starmap_type, | |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
3059 &chain_type, |
|
45736
7752a57f9c49
Rename ifilterfalse() to filterfalse() and izip_longest() to zip_longest().
Raymond Hettinger <python@rcn.com>
parents:
45735
diff
changeset
|
3060 &filterfalse_type, |
| 27769 | 3061 &count_type, |
|
45738
740b5808c57a
Move itertools izip() code to builtins as zip(). Complete the renaming.
Raymond Hettinger <python@rcn.com>
parents:
45736
diff
changeset
|
3062 &ziplongest_type, |
|
45773
832c820e9d14
Merged revisions 61239-61249,61252-61257,61260-61264,61269-61275,61278-61279,61285-61286,61288-61290,61298,61303-61305,61312-61314,61317,61329,61332,61344,61350-61351,61363-61376,61378-61379,61382-61383,61387-61388,61392,61395-61396,61402-61403 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45738
diff
changeset
|
3063 &permutations_type, |
|
45548
8c3c5b4eef55
Merged revisions 61038,61042-61045,61047,61050,61053,61055-61056,61061-61062,61066,61068,61070,61081-61095 via svnmerge from
Christian Heimes <christian@cheimes.de>
parents:
45534
diff
changeset
|
3064 &product_type, |
| 27769 | 3065 &repeat_type, |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
3066 &groupby_type, |
| 27769 | 3067 NULL |
| 3068 }; | |
| 3069 | |
|
44351
86a2679dca46
#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT.
Christian Heimes <christian@cheimes.de>
parents:
44099
diff
changeset
|
3070 Py_TYPE(&teedataobject_type) = &PyType_Type; |
|
47580
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3071 m = PyModule_Create(&itertoolsmodule); |
|
36324
1af7f719ed28
Check return result from Py_InitModule*(). This API can fail.
Neal Norwitz <nnorwitz@gmail.com>
parents:
35999
diff
changeset
|
3072 if (m == NULL) |
|
47580
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3073 return NULL; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3074 |
| 27769 | 3075 for (i=0 ; typelist[i] != NULL ; i++) { |
| 3076 if (PyType_Ready(typelist[i]) < 0) | |
|
47580
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3077 return NULL; |
|
29225
f3f306457b43
Fixed dotted name assertion.
Raymond Hettinger <python@rcn.com>
parents:
28945
diff
changeset
|
3078 name = strchr(typelist[i]->tp_name, '.'); |
|
28024
61fa6b55c1de
User requested changes to the itertools module.
Raymond Hettinger <python@rcn.com>
parents:
27770
diff
changeset
|
3079 assert (name != NULL); |
| 27769 | 3080 Py_INCREF(typelist[i]); |
|
29225
f3f306457b43
Fixed dotted name assertion.
Raymond Hettinger <python@rcn.com>
parents:
28945
diff
changeset
|
3081 PyModule_AddObject(m, name+1, (PyObject *)typelist[i]); |
| 27769 | 3082 } |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
3083 |
|
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
3084 if (PyType_Ready(&teedataobject_type) < 0) |
|
47580
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3085 return NULL; |
|
30900
3096fab2a19c
Improve the implementation of itertools.tee().
Raymond Hettinger <python@rcn.com>
parents:
30800
diff
changeset
|
3086 if (PyType_Ready(&tee_type) < 0) |
|
47580
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3087 return NULL; |
|
31136
fde74fadf780
Implement itertools.groupby()
Raymond Hettinger <python@rcn.com>
parents:
30900
diff
changeset
|
3088 if (PyType_Ready(&_grouper_type) < 0) |
|
47580
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3089 return NULL; |
|
94f64f11fdd0
Implement PEP 3121: new module initialization and finalization API.
Martin v. Löwis <martin@v.loewis.de>
parents:
47555
diff
changeset
|
3090 return m; |
|
27570
ba57c3daf6e9
Move itertools module from the sandbox and into production.
Raymond Hettinger <python@rcn.com>
parents:
diff
changeset
|
3091 } |
