Mercurial > cpython-lru_cache-weakref
annotate Objects/structseq.c @ 20891:41d2d00a31f1 legacy-trunk
Update obsolete e-mail address
| author | Andrew M. Kuchling <amk@amk.ca> |
|---|---|
| date | Mon, 05 Nov 2001 21:31:33 +0000 |
| parents | ab2e315849a7 |
| children | 94f5a9fa3583 |
| rev | line source |
|---|---|
|
20540
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
1 /* Implementation helper: a struct that looks like a tuple. See timemodule |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
2 and posixmodule for example uses. */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
3 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
4 #include "Python.h" |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
5 #include "structmember.h" |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
6 #include "structseq.h" |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
7 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
8 static char visible_length_key[] = "n_sequence_fields"; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
9 static char real_length_key[] = "n_fields"; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
10 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
11 #define VISIBLE_SIZE(op) ((op)->ob_size) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
12 #define VISIBLE_SIZE_TP(tp) PyInt_AsLong( \ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
13 PyDict_GetItemString((tp)->tp_dict, visible_length_key)) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
14 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
15 #define REAL_SIZE_TP(tp) PyInt_AsLong( \ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
16 PyDict_GetItemString((tp)->tp_dict, real_length_key)) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
17 #define REAL_SIZE(op) REAL_SIZE_TP((op)->ob_type) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
18 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
19 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
20 PyObject * |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
21 PyStructSequence_New(PyTypeObject *type) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
22 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
23 PyStructSequence *obj; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
24 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
25 obj = PyObject_New(PyStructSequence, type); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
26 obj->ob_size = VISIBLE_SIZE_TP(type); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
27 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
28 return (PyObject*) obj; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
29 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
30 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
31 static void |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
32 structseq_dealloc(PyStructSequence *obj) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
33 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
34 int i, size; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
35 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
36 size = REAL_SIZE(obj); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
37 for (i = 0; i < size; ++i) { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
38 Py_XDECREF(obj->ob_item[i]); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
39 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
40 PyObject_FREE(obj); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
41 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
42 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
43 static int |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
44 structseq_length(PyStructSequence *obj) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
45 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
46 return VISIBLE_SIZE(obj); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
47 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
48 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
49 static PyObject* |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
50 structseq_item(PyStructSequence *obj, int i) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
51 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
52 if (i < 0 || i >= VISIBLE_SIZE(obj)) { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
53 PyErr_SetString(PyExc_IndexError, "tuple index out of range"); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
54 return NULL; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
55 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
56 Py_INCREF(obj->ob_item[i]); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
57 return obj->ob_item[i]; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
58 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
59 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
60 static PyObject* |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
61 structseq_slice(PyStructSequence *obj, int low, int high) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
62 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
63 PyTupleObject *np; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
64 int i; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
65 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
66 if (low < 0) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
67 low = 0; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
68 if (high > VISIBLE_SIZE(obj)) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
69 high = VISIBLE_SIZE(obj); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
70 if (high < low) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
71 high = low; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
72 np = (PyTupleObject *)PyTuple_New(high-low); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
73 if (np == NULL) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
74 return NULL; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
75 for(i = low; i < high; ++i) { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
76 PyObject *v = obj->ob_item[i]; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
77 Py_INCREF(v); |
|
20780
ab2e315849a7
Fix bad bug in structseq slicing (NULL pointers in result). Reported by
Tim Peters <tim.peters@gmail.com>
parents:
20540
diff
changeset
|
78 PyTuple_SET_ITEM(np, i-low, v); |
|
20540
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
79 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
80 return (PyObject *) np; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
81 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
82 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
83 static PyObject * |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
84 structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwds) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
85 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
86 PyObject *arg = NULL; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
87 PyStructSequence *res = NULL; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
88 int len, required_len, i; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
89 static char *kwlist[] = {"sequence", 0}; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
90 static char msgbuf[128]; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
91 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
92 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:structseq", |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
93 kwlist, &arg)) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
94 return NULL; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
95 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
96 if (!PySequence_Check(arg)) { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
97 PyErr_SetString(PyExc_TypeError, |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
98 "constructor requires a sequence"); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
99 return NULL; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
100 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
101 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
102 len = PySequence_Length(arg); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
103 required_len = REAL_SIZE_TP(type); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
104 if (len != required_len) { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
105 sprintf(msgbuf, |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
106 "constructor takes exactly %d arguments (%d given)", |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
107 required_len, |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
108 len); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
109 PyErr_SetString(PyExc_TypeError, msgbuf); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
110 return NULL; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
111 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
112 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
113 res = (PyStructSequence*) PyStructSequence_New(type); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
114 for (i = 0; i < len; ++i) { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
115 /* INCREF???? XXXX */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
116 res->ob_item[i] = PySequence_GetItem(arg, i); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
117 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
118 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
119 return (PyObject*) res; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
120 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
121 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
122 static PyObject * |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
123 make_tuple(PyStructSequence *obj) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
124 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
125 return structseq_slice(obj, 0, VISIBLE_SIZE(obj)); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
126 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
127 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
128 static PyObject * |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
129 structseq_repr(PyStructSequence *obj) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
130 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
131 PyObject *tup, *str; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
132 tup = make_tuple(obj); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
133 str = PyObject_Repr(tup); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
134 Py_DECREF(tup); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
135 return str; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
136 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
137 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
138 static PyObject * |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
139 structseq_concat(PyStructSequence *obj, PyObject *b) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
140 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
141 PyObject *tup, *result; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
142 tup = make_tuple(obj); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
143 result = PySequence_Concat(tup, b); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
144 Py_DECREF(tup); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
145 return result; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
146 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
147 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
148 static PyObject * |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
149 structseq_repeat(PyStructSequence *obj, int n) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
150 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
151 PyObject *tup, *result; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
152 tup = make_tuple(obj); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
153 result = PySequence_Repeat(tup, n); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
154 Py_DECREF(tup); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
155 return result; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
156 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
157 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
158 static int |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
159 structseq_contains(PyStructSequence *obj, PyObject *o) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
160 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
161 PyObject *tup; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
162 int result; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
163 tup = make_tuple(obj); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
164 result = PySequence_Contains(tup, o); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
165 Py_DECREF(tup); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
166 return result; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
167 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
168 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
169 static long |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
170 structseq_hash(PyObject *obj) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
171 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
172 PyObject *tup; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
173 long result; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
174 tup = make_tuple((PyStructSequence*) obj); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
175 result = PyObject_Hash(tup); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
176 Py_DECREF(tup); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
177 return result; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
178 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
179 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
180 static PyObject * |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
181 structseq_richcompare(PyObject *obj, PyObject *o2, int op) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
182 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
183 PyObject *tup, *result; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
184 tup = make_tuple((PyStructSequence*) obj); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
185 result = PyObject_RichCompare(tup, o2, op); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
186 Py_DECREF(tup); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
187 return result; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
188 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
189 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
190 static PySequenceMethods structseq_as_sequence = { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
191 (inquiry)structseq_length, |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
192 (binaryfunc)structseq_concat, /* sq_concat */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
193 (intargfunc)structseq_repeat, /* sq_repeat */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
194 (intargfunc)structseq_item, /* sq_item */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
195 (intintargfunc)structseq_slice, /* sq_slice */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
196 0, /* sq_ass_item */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
197 0, /* sq_ass_slice */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
198 (objobjproc)structseq_contains, /* sq_contains */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
199 }; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
200 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
201 static PyTypeObject _struct_sequence_template = { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
202 PyObject_HEAD_INIT(&PyType_Type) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
203 0, /* ob_size */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
204 NULL, /* tp_name */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
205 0, /* tp_basicsize */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
206 0, /* tp_itemsize */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
207 (destructor)structseq_dealloc, /* tp_dealloc */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
208 0, /* tp_print */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
209 0, /* tp_getattr */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
210 0, /* tp_setattr */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
211 0, /* tp_compare */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
212 (reprfunc)structseq_repr, /* tp_repr */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
213 0, /* tp_as_number */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
214 &structseq_as_sequence, /* tp_as_sequence */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
215 0, /* tp_as_mapping */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
216 (hashfunc)structseq_hash, /* tp_hash */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
217 0, /* tp_call */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
218 0, /* tp_str */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
219 0, /* tp_getattro */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
220 0, /* tp_setattro */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
221 0, /* tp_as_buffer */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
222 Py_TPFLAGS_DEFAULT, /* tp_flags */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
223 NULL, /* tp_doc */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
224 0, /* tp_traverse */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
225 0, /* tp_clear */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
226 structseq_richcompare, /* tp_richcompare */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
227 0, /* tp_weaklistoffset */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
228 0, /* tp_iter */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
229 0, /* tp_iternext */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
230 0, /* tp_methods */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
231 NULL, /* tp_members */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
232 0, /* tp_getset */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
233 0, /* tp_base */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
234 0, /* tp_dict */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
235 0, /* tp_descr_get */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
236 0, /* tp_descr_set */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
237 0, /* tp_dictoffset */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
238 0, /* tp_init */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
239 0, /* tp_alloc */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
240 structseq_new, /* tp_new */ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
241 }; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
242 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
243 void |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
244 PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
245 { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
246 PyObject *dict; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
247 PyMemberDef* members; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
248 int n_members, i; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
249 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
250 for (i = 0; desc->fields[i].name != NULL; ++i) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
251 ; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
252 n_members = i; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
253 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
254 memcpy(type, &_struct_sequence_template, sizeof(PyTypeObject)); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
255 type->tp_name = desc->name; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
256 type->tp_doc = desc->doc; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
257 type->tp_basicsize = sizeof(PyStructSequence)+ |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
258 sizeof(PyObject*)*(n_members-1); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
259 type->tp_itemsize = 0; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
260 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
261 members = PyMem_NEW(PyMemberDef, n_members+1); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
262 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
263 for (i = 0; i < n_members; ++i) { |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
264 members[i].name = desc->fields[i].name; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
265 members[i].type = T_OBJECT; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
266 members[i].offset = offsetof(PyStructSequence, ob_item) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
267 + i * sizeof(PyObject*); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
268 members[i].flags = READONLY; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
269 members[i].doc = desc->fields[i].doc; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
270 } |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
271 members[n_members].name = NULL; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
272 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
273 type->tp_members = members; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
274 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
275 if (PyType_Ready(type) < 0) |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
276 return; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
277 Py_INCREF(type); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
278 |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
279 dict = type->tp_dict; |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
280 PyDict_SetItemString(dict, visible_length_key, |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
281 PyInt_FromLong((long) desc->n_in_sequence)); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
282 PyDict_SetItemString(dict, real_length_key, |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
283 PyInt_FromLong((long) n_members)); |
|
ad2662095d77
Missing file structseq.c for SF patch #462296
Guido van Rossum <guido@python.org>
parents:
diff
changeset
|
284 } |
