| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 1 | /* | 
 | 2 | Written by Jim Hugunin and Chris Chase. | 
 | 3 |  | 
| Guido van Rossum | e449af7 | 1996-10-11 16:25:41 +0000 | [diff] [blame] | 4 | This includes both the singular ellipsis object and slice objects. | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 5 |  | 
 | 6 | Guido, feel free to do whatever you want in the way of copyrights | 
 | 7 | for this file. | 
 | 8 | */ | 
 | 9 |  | 
 | 10 | /*  | 
| Guido van Rossum | e449af7 | 1996-10-11 16:25:41 +0000 | [diff] [blame] | 11 | Py_Ellipsis encodes the '...' rubber index token. It is similar to | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 12 | the Py_NoneStruct in that there is no way to create other objects of | 
 | 13 | this type and there is exactly one in existence. | 
 | 14 | */ | 
 | 15 |  | 
 | 16 | #include "Python.h" | 
| Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 17 | #include "structmember.h" | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 18 |  | 
 | 19 | static PyObject * | 
| Fred Drake | 45cfbcc | 2000-07-09 06:21:27 +0000 | [diff] [blame] | 20 | ellipsis_repr(PyObject *op) | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 21 | { | 
| Guido van Rossum | e449af7 | 1996-10-11 16:25:41 +0000 | [diff] [blame] | 22 | 	return PyString_FromString("Ellipsis"); | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 23 | } | 
 | 24 |  | 
| Guido van Rossum | e449af7 | 1996-10-11 16:25:41 +0000 | [diff] [blame] | 25 | static PyTypeObject PyEllipsis_Type = { | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 26 | 	PyObject_HEAD_INIT(&PyType_Type) | 
| Guido van Rossum | d82fb78 | 2001-10-30 02:40:52 +0000 | [diff] [blame] | 27 | 	0,					/* ob_size */ | 
 | 28 | 	"ellipsis",				/* tp_name */ | 
 | 29 | 	0,					/* tp_basicsize */ | 
 | 30 | 	0,					/* tp_itemsize */ | 
 | 31 | 	0, /*never called*/			/* tp_dealloc */ | 
 | 32 | 	0,					/* tp_print */ | 
 | 33 | 	0,					/* tp_getattr */ | 
 | 34 | 	0,					/* tp_setattr */ | 
 | 35 | 	0,					/* tp_compare */ | 
 | 36 | 	(reprfunc)ellipsis_repr,		/* tp_repr */ | 
 | 37 | 	0,					/* tp_as_number */ | 
 | 38 | 	0,					/* tp_as_sequence */ | 
 | 39 | 	0,					/* tp_as_mapping */ | 
 | 40 | 	0,					/* tp_hash */ | 
 | 41 | 	0,					/* tp_call */ | 
 | 42 | 	0,					/* tp_str */ | 
 | 43 | 	PyObject_GenericGetAttr,		/* tp_getattro */ | 
 | 44 | 	0,					/* tp_setattro */ | 
 | 45 | 	0,					/* tp_as_buffer */ | 
 | 46 | 	Py_TPFLAGS_DEFAULT,			/* tp_flags */ | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 47 | }; | 
 | 48 |  | 
| Guido van Rossum | e449af7 | 1996-10-11 16:25:41 +0000 | [diff] [blame] | 49 | PyObject _Py_EllipsisObject = { | 
 | 50 | 	PyObject_HEAD_INIT(&PyEllipsis_Type) | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 51 | }; | 
 | 52 |  | 
 | 53 |  | 
 | 54 | /* Slice object implementation | 
 | 55 |  | 
 | 56 |    start, stop, and step are python objects with None indicating no | 
 | 57 |    index is present. | 
 | 58 | */ | 
 | 59 |  | 
 | 60 | PyObject * | 
| Fred Drake | 45cfbcc | 2000-07-09 06:21:27 +0000 | [diff] [blame] | 61 | PySlice_New(PyObject *start, PyObject *stop, PyObject *step) | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 62 | { | 
| Neil Schemenauer | 7465ad2 | 2002-04-12 03:05:37 +0000 | [diff] [blame] | 63 | 	PySliceObject *obj = PyObject_New(PySliceObject, &PySlice_Type); | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 64 |  | 
| Guido van Rossum | adf5410 | 2000-12-14 15:09:46 +0000 | [diff] [blame] | 65 | 	if (obj == NULL) | 
 | 66 | 		return NULL; | 
 | 67 |  | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 68 | 	if (step == NULL) step = Py_None; | 
 | 69 | 	Py_INCREF(step); | 
 | 70 | 	if (start == NULL) start = Py_None; | 
 | 71 | 	Py_INCREF(start); | 
 | 72 | 	if (stop == NULL) stop = Py_None; | 
 | 73 | 	Py_INCREF(stop); | 
 | 74 |  | 
 | 75 | 	obj->step = step; | 
 | 76 | 	obj->start = start; | 
 | 77 | 	obj->stop = stop; | 
 | 78 |  | 
 | 79 | 	return (PyObject *) obj; | 
 | 80 | } | 
 | 81 |  | 
 | 82 | int | 
| Martin v. Löwis | 18e1655 | 2006-02-15 17:27:45 +0000 | [diff] [blame] | 83 | PySlice_GetIndices(PySliceObject *r, Py_ssize_t length, | 
 | 84 |                    Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 85 | { | 
| Martin v. Löwis | 18e1655 | 2006-02-15 17:27:45 +0000 | [diff] [blame] | 86 | 	/* XXX support long ints */ | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 87 | 	if (r->step == Py_None) { | 
 | 88 | 		*step = 1; | 
 | 89 | 	} else { | 
 | 90 | 		if (!PyInt_Check(r->step)) return -1; | 
 | 91 | 		*step = PyInt_AsLong(r->step); | 
 | 92 | 	} | 
 | 93 | 	if (r->start == Py_None) { | 
 | 94 | 		*start = *step < 0 ? length-1 : 0; | 
 | 95 | 	} else { | 
 | 96 | 		if (!PyInt_Check(r->start)) return -1; | 
 | 97 | 		*start = PyInt_AsLong(r->start); | 
 | 98 | 		if (*start < 0) *start += length; | 
 | 99 | 	} | 
 | 100 | 	if (r->stop == Py_None) { | 
 | 101 | 		*stop = *step < 0 ? -1 : length; | 
 | 102 | 	} else { | 
 | 103 | 		if (!PyInt_Check(r->stop)) return -1; | 
 | 104 | 		*stop = PyInt_AsLong(r->stop); | 
 | 105 | 		if (*stop < 0) *stop += length; | 
 | 106 | 	} | 
 | 107 | 	if (*stop > length) return -1; | 
 | 108 | 	if (*start >= length) return -1; | 
 | 109 | 	if (*step == 0) return -1; | 
 | 110 | 	return 0; | 
 | 111 | } | 
 | 112 |  | 
| Michael W. Hudson | 5efaf7e | 2002-06-11 10:55:12 +0000 | [diff] [blame] | 113 | int | 
| Martin v. Löwis | 18e1655 | 2006-02-15 17:27:45 +0000 | [diff] [blame] | 114 | PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length, | 
 | 115 | 		     Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength) | 
| Michael W. Hudson | 5efaf7e | 2002-06-11 10:55:12 +0000 | [diff] [blame] | 116 | { | 
 | 117 | 	/* this is harder to get right than you might think */ | 
| Michael W. Hudson | 173f11d | 2002-11-05 15:28:51 +0000 | [diff] [blame] | 118 |  | 
| Martin v. Löwis | 18e1655 | 2006-02-15 17:27:45 +0000 | [diff] [blame] | 119 | 	Py_ssize_t defstart, defstop; | 
| Michael W. Hudson | 5efaf7e | 2002-06-11 10:55:12 +0000 | [diff] [blame] | 120 |  | 
 | 121 | 	if (r->step == Py_None) { | 
 | 122 | 		*step = 1; | 
| Michael W. Hudson | 173f11d | 2002-11-05 15:28:51 +0000 | [diff] [blame] | 123 | 	}  | 
 | 124 | 	else { | 
| Michael W. Hudson | cbd6fb9 | 2002-11-06 15:17:32 +0000 | [diff] [blame] | 125 | 		if (!_PyEval_SliceIndex(r->step, step)) return -1; | 
 | 126 | 		if (*step == 0) { | 
| Michael W. Hudson | 5efaf7e | 2002-06-11 10:55:12 +0000 | [diff] [blame] | 127 | 			PyErr_SetString(PyExc_ValueError, | 
 | 128 | 					"slice step cannot be zero"); | 
 | 129 | 			return -1; | 
 | 130 | 		} | 
 | 131 | 	} | 
 | 132 |  | 
 | 133 | 	defstart = *step < 0 ? length-1 : 0; | 
 | 134 | 	defstop = *step < 0 ? -1 : length; | 
 | 135 |  | 
 | 136 | 	if (r->start == Py_None) { | 
 | 137 | 		*start = defstart; | 
| Michael W. Hudson | 173f11d | 2002-11-05 15:28:51 +0000 | [diff] [blame] | 138 | 	} | 
 | 139 | 	else { | 
| Michael W. Hudson | 5efaf7e | 2002-06-11 10:55:12 +0000 | [diff] [blame] | 140 | 		if (!_PyEval_SliceIndex(r->start, start)) return -1; | 
 | 141 | 		if (*start < 0) *start += length; | 
 | 142 | 		if (*start < 0) *start = (*step < 0) ? -1 : 0; | 
 | 143 | 		if (*start >= length)  | 
 | 144 | 			*start = (*step < 0) ? length - 1 : length; | 
 | 145 | 	} | 
 | 146 |  | 
 | 147 | 	if (r->stop == Py_None) { | 
 | 148 | 		*stop = defstop; | 
| Michael W. Hudson | 173f11d | 2002-11-05 15:28:51 +0000 | [diff] [blame] | 149 | 	} | 
 | 150 | 	else { | 
| Michael W. Hudson | 5efaf7e | 2002-06-11 10:55:12 +0000 | [diff] [blame] | 151 | 		if (!_PyEval_SliceIndex(r->stop, stop)) return -1; | 
 | 152 | 		if (*stop < 0) *stop += length; | 
 | 153 | 		if (*stop < 0) *stop = -1; | 
 | 154 | 		if (*stop > length) *stop = length; | 
 | 155 | 	} | 
| Michael W. Hudson | 173f11d | 2002-11-05 15:28:51 +0000 | [diff] [blame] | 156 |  | 
 | 157 | 	if ((*step < 0 && *stop >= *start)  | 
 | 158 | 	    || (*step > 0 && *start >= *stop)) { | 
| Michael W. Hudson | 589dc93 | 2002-06-11 13:38:42 +0000 | [diff] [blame] | 159 | 		*slicelength = 0; | 
 | 160 | 	} | 
 | 161 | 	else if (*step < 0) { | 
| Michael W. Hudson | 5efaf7e | 2002-06-11 10:55:12 +0000 | [diff] [blame] | 162 | 		*slicelength = (*stop-*start+1)/(*step)+1; | 
| Michael W. Hudson | 173f11d | 2002-11-05 15:28:51 +0000 | [diff] [blame] | 163 | 	} | 
 | 164 | 	else { | 
| Michael W. Hudson | 5efaf7e | 2002-06-11 10:55:12 +0000 | [diff] [blame] | 165 | 		*slicelength = (*stop-*start-1)/(*step)+1; | 
 | 166 | 	} | 
| Michael W. Hudson | 5efaf7e | 2002-06-11 10:55:12 +0000 | [diff] [blame] | 167 |  | 
 | 168 | 	return 0; | 
 | 169 | } | 
 | 170 |  | 
| Guido van Rossum | bea18cc | 2002-06-14 20:41:17 +0000 | [diff] [blame] | 171 | static PyObject * | 
 | 172 | slice_new(PyTypeObject *type, PyObject *args, PyObject *kw) | 
 | 173 | { | 
 | 174 | 	PyObject *start, *stop, *step; | 
 | 175 |  | 
 | 176 | 	start = stop = step = NULL; | 
 | 177 |  | 
| Georg Brandl | 02c4287 | 2005-08-26 06:42:30 +0000 | [diff] [blame] | 178 | 	if (!_PyArg_NoKeywords("slice()", kw)) | 
 | 179 | 		return NULL; | 
 | 180 |  | 
| Raymond Hettinger | ea3fdf4 | 2002-12-29 16:33:45 +0000 | [diff] [blame] | 181 | 	if (!PyArg_UnpackTuple(args, "slice", 1, 3, &start, &stop, &step)) | 
| Guido van Rossum | bea18cc | 2002-06-14 20:41:17 +0000 | [diff] [blame] | 182 | 		return NULL; | 
 | 183 |  | 
 | 184 | 	/* This swapping of stop and start is to maintain similarity with | 
 | 185 | 	   range(). */ | 
 | 186 | 	if (stop == NULL) { | 
 | 187 | 		stop = start; | 
 | 188 | 		start = NULL; | 
 | 189 | 	} | 
 | 190 | 	return PySlice_New(start, stop, step); | 
 | 191 | } | 
 | 192 |  | 
 | 193 | PyDoc_STRVAR(slice_doc, | 
 | 194 | "slice([start,] stop[, step])\n\ | 
 | 195 | \n\ | 
 | 196 | Create a slice object.  This is used for extended slicing (e.g. a[0:10:2])."); | 
 | 197 |  | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 198 | static void | 
| Fred Drake | 45cfbcc | 2000-07-09 06:21:27 +0000 | [diff] [blame] | 199 | slice_dealloc(PySliceObject *r) | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 200 | { | 
 | 201 | 	Py_DECREF(r->step); | 
 | 202 | 	Py_DECREF(r->start); | 
 | 203 | 	Py_DECREF(r->stop); | 
| Neil Schemenauer | 7465ad2 | 2002-04-12 03:05:37 +0000 | [diff] [blame] | 204 | 	PyObject_Del(r); | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 205 | } | 
 | 206 |  | 
 | 207 | static PyObject * | 
| Fred Drake | 45cfbcc | 2000-07-09 06:21:27 +0000 | [diff] [blame] | 208 | slice_repr(PySliceObject *r) | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 209 | { | 
 | 210 | 	PyObject *s, *comma; | 
 | 211 |  | 
 | 212 | 	s = PyString_FromString("slice("); | 
 | 213 | 	comma = PyString_FromString(", "); | 
 | 214 | 	PyString_ConcatAndDel(&s, PyObject_Repr(r->start)); | 
 | 215 | 	PyString_Concat(&s, comma); | 
 | 216 | 	PyString_ConcatAndDel(&s, PyObject_Repr(r->stop)); | 
 | 217 | 	PyString_Concat(&s, comma); | 
 | 218 | 	PyString_ConcatAndDel(&s, PyObject_Repr(r->step)); | 
 | 219 | 	PyString_ConcatAndDel(&s, PyString_FromString(")")); | 
 | 220 | 	Py_DECREF(comma); | 
 | 221 | 	return s; | 
 | 222 | } | 
 | 223 |  | 
| Guido van Rossum | 6f79937 | 2001-09-20 20:46:19 +0000 | [diff] [blame] | 224 | static PyMemberDef slice_members[] = { | 
| Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 225 | 	{"start", T_OBJECT, offsetof(PySliceObject, start), READONLY}, | 
 | 226 | 	{"stop", T_OBJECT, offsetof(PySliceObject, stop), READONLY}, | 
 | 227 | 	{"step", T_OBJECT, offsetof(PySliceObject, step), READONLY}, | 
 | 228 | 	{0} | 
 | 229 | }; | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 230 |  | 
| Michael W. Hudson | f0d777c | 2002-07-19 15:47:06 +0000 | [diff] [blame] | 231 | static PyObject* | 
 | 232 | slice_indices(PySliceObject* self, PyObject* len) | 
 | 233 | { | 
| Martin v. Löwis | 18e1655 | 2006-02-15 17:27:45 +0000 | [diff] [blame] | 234 | 	Py_ssize_t ilen, start, stop, step, slicelength; | 
| Michael W. Hudson | f0d777c | 2002-07-19 15:47:06 +0000 | [diff] [blame] | 235 |  | 
 | 236 | 	ilen = PyInt_AsLong(len); | 
 | 237 |  | 
 | 238 | 	if (ilen == -1 && PyErr_Occurred()) { | 
 | 239 | 		return NULL; | 
 | 240 | 	} | 
 | 241 |  | 
 | 242 | 	if (PySlice_GetIndicesEx(self, ilen, &start, &stop,  | 
 | 243 | 				 &step, &slicelength) < 0) { | 
 | 244 | 		return NULL; | 
 | 245 | 	} | 
 | 246 |  | 
| Michael W. Hudson | 5c1ad84 | 2002-09-12 09:31:30 +0000 | [diff] [blame] | 247 | 	return Py_BuildValue("(iii)", start, stop, step); | 
| Michael W. Hudson | f0d777c | 2002-07-19 15:47:06 +0000 | [diff] [blame] | 248 | } | 
 | 249 |  | 
 | 250 | PyDoc_STRVAR(slice_indices_doc, | 
 | 251 | "S.indices(len) -> (start, stop, stride)\n\ | 
 | 252 | \n\ | 
 | 253 | Assuming a sequence of length len, calculate the start and stop\n\ | 
 | 254 | indices, and the stride length of the extended slice described by\n\ | 
 | 255 | S. Out of bounds indices are clipped in a manner consistent with the\n\ | 
 | 256 | handling of normal slices."); | 
 | 257 |  | 
 | 258 | static PyMethodDef slice_methods[] = { | 
| Michael W. Hudson | 206d8f8 | 2002-07-19 15:52:38 +0000 | [diff] [blame] | 259 | 	{"indices",	(PyCFunction)slice_indices, | 
| Michael W. Hudson | f0d777c | 2002-07-19 15:47:06 +0000 | [diff] [blame] | 260 | 	 METH_O,	slice_indices_doc}, | 
 | 261 | 	{NULL, NULL} | 
 | 262 | }; | 
 | 263 |  | 
| Guido van Rossum | a1351fb | 2001-03-20 12:41:34 +0000 | [diff] [blame] | 264 | static int | 
 | 265 | slice_compare(PySliceObject *v, PySliceObject *w) | 
 | 266 | { | 
 | 267 | 	int result = 0; | 
 | 268 |  | 
 | 269 |         if (v == w) | 
 | 270 | 		return 0; | 
 | 271 |  | 
 | 272 | 	if (PyObject_Cmp(v->start, w->start, &result) < 0) | 
 | 273 | 	    return -2; | 
 | 274 | 	if (result != 0) | 
 | 275 | 		return result; | 
 | 276 | 	if (PyObject_Cmp(v->stop, w->stop, &result) < 0) | 
 | 277 | 	    return -2; | 
 | 278 | 	if (result != 0) | 
 | 279 | 		return result; | 
 | 280 | 	if (PyObject_Cmp(v->step, w->step, &result) < 0) | 
 | 281 | 	    return -2; | 
 | 282 | 	return result; | 
 | 283 | } | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 284 |  | 
| Raymond Hettinger | b859c07 | 2003-09-05 14:27:30 +0000 | [diff] [blame] | 285 | static long | 
 | 286 | slice_hash(PySliceObject *v) | 
 | 287 | { | 
 | 288 | 	PyErr_SetString(PyExc_TypeError, "unhashable type"); | 
 | 289 | 	return -1L; | 
 | 290 | } | 
 | 291 |  | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 292 | PyTypeObject PySlice_Type = { | 
 | 293 | 	PyObject_HEAD_INIT(&PyType_Type) | 
 | 294 | 	0,			/* Number of items for varobject */ | 
 | 295 | 	"slice",		/* Name of this type */ | 
 | 296 | 	sizeof(PySliceObject),	/* Basic object size */ | 
 | 297 | 	0,			/* Item size for varobject */ | 
| Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 298 | 	(destructor)slice_dealloc,		/* tp_dealloc */ | 
 | 299 | 	0,					/* tp_print */ | 
 | 300 | 	0,					/* tp_getattr */ | 
 | 301 | 	0,					/* tp_setattr */ | 
 | 302 | 	(cmpfunc)slice_compare, 		/* tp_compare */ | 
 | 303 | 	(reprfunc)slice_repr,   		/* tp_repr */ | 
 | 304 | 	0,					/* tp_as_number */ | 
 | 305 | 	0,	    				/* tp_as_sequence */ | 
 | 306 | 	0,					/* tp_as_mapping */ | 
| Raymond Hettinger | b859c07 | 2003-09-05 14:27:30 +0000 | [diff] [blame] | 307 | 	(hashfunc)slice_hash,			/* tp_hash */ | 
| Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 308 | 	0,					/* tp_call */ | 
 | 309 | 	0,					/* tp_str */ | 
 | 310 | 	PyObject_GenericGetAttr,		/* tp_getattro */ | 
 | 311 | 	0,					/* tp_setattro */ | 
 | 312 | 	0,					/* tp_as_buffer */ | 
 | 313 | 	Py_TPFLAGS_DEFAULT,			/* tp_flags */ | 
| Guido van Rossum | bea18cc | 2002-06-14 20:41:17 +0000 | [diff] [blame] | 314 | 	slice_doc,				/* tp_doc */ | 
| Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 315 | 	0,					/* tp_traverse */ | 
 | 316 | 	0,					/* tp_clear */ | 
 | 317 | 	0,					/* tp_richcompare */ | 
 | 318 | 	0,					/* tp_weaklistoffset */ | 
 | 319 | 	0,					/* tp_iter */ | 
 | 320 | 	0,					/* tp_iternext */ | 
| Michael W. Hudson | f0d777c | 2002-07-19 15:47:06 +0000 | [diff] [blame] | 321 | 	slice_methods,				/* tp_methods */ | 
| Tim Peters | 6d6c1a3 | 2001-08-02 04:15:00 +0000 | [diff] [blame] | 322 | 	slice_members,				/* tp_members */ | 
 | 323 | 	0,					/* tp_getset */ | 
 | 324 | 	0,					/* tp_base */ | 
 | 325 | 	0,					/* tp_dict */ | 
| Guido van Rossum | bea18cc | 2002-06-14 20:41:17 +0000 | [diff] [blame] | 326 | 	0,					/* tp_descr_get */ | 
 | 327 | 	0,					/* tp_descr_set */ | 
 | 328 | 	0,					/* tp_dictoffset */ | 
 | 329 | 	0,					/* tp_init */ | 
 | 330 | 	0,					/* tp_alloc */ | 
 | 331 | 	slice_new,				/* tp_new */ | 
| Guido van Rossum | f2d125b | 1996-07-30 16:45:48 +0000 | [diff] [blame] | 332 | }; |