summaryrefslogtreecommitdiffstats
path: root/Objects/structseq.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-02-15 17:27:45 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-02-15 17:27:45 (GMT)
commit18e165558b24d29e7e0ca501842b9236589b012a (patch)
tree841678b5dc1aff3aa48701fee33a6ba7be00a72b /Objects/structseq.c
parent44829297348d9121a03fc7df2fac557b583cc7fa (diff)
downloadcpython-18e165558b24d29e7e0ca501842b9236589b012a.zip
cpython-18e165558b24d29e7e0ca501842b9236589b012a.tar.gz
cpython-18e165558b24d29e7e0ca501842b9236589b012a.tar.bz2
Merge ssize_t branch.
Diffstat (limited to 'Objects/structseq.c')
-rw-r--r--Objects/structseq.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/Objects/structseq.c b/Objects/structseq.c
index ac3cf03..b035ca2 100644
--- a/Objects/structseq.c
+++ b/Objects/structseq.c
@@ -40,7 +40,7 @@ PyStructSequence_New(PyTypeObject *type)
static void
structseq_dealloc(PyStructSequence *obj)
{
- int i, size;
+ Py_ssize_t i, size;
size = REAL_SIZE(obj);
for (i = 0; i < size; ++i) {
@@ -49,14 +49,14 @@ structseq_dealloc(PyStructSequence *obj)
PyObject_Del(obj);
}
-static int
+static Py_ssize_t
structseq_length(PyStructSequence *obj)
{
return VISIBLE_SIZE(obj);
}
static PyObject*
-structseq_item(PyStructSequence *obj, int i)
+structseq_item(PyStructSequence *obj, Py_ssize_t i)
{
if (i < 0 || i >= VISIBLE_SIZE(obj)) {
PyErr_SetString(PyExc_IndexError, "tuple index out of range");
@@ -67,10 +67,10 @@ structseq_item(PyStructSequence *obj, int i)
}
static PyObject*
-structseq_slice(PyStructSequence *obj, int low, int high)
+structseq_slice(PyStructSequence *obj, Py_ssize_t low, Py_ssize_t high)
{
PyTupleObject *np;
- int i;
+ Py_ssize_t i;
if (low < 0)
low = 0;
@@ -96,7 +96,7 @@ structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
PyObject *dict = NULL;
PyObject *ob;
PyStructSequence *res = NULL;
- int len, min_len, max_len, i, n_unnamed_fields;
+ Py_ssize_t len, min_len, max_len, i, n_unnamed_fields;
static const char *kwlist[] = {"sequence", "dict", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:structseq",
@@ -125,7 +125,7 @@ structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (min_len != max_len) {
if (len < min_len) {
PyErr_Format(PyExc_TypeError,
- "%.500s() takes an at least %d-sequence (%d-sequence given)",
+ "%.500s() takes an at least %ld-sequence (%ld-sequence given)",
type->tp_name, min_len, len);
Py_DECREF(arg);
return NULL;
@@ -133,7 +133,7 @@ structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
if (len > max_len) {
PyErr_Format(PyExc_TypeError,
- "%.500s() takes an at most %d-sequence (%d-sequence given)",
+ "%.500s() takes an at most %ld-sequence (%ld-sequence given)",
type->tp_name, max_len, len);
Py_DECREF(arg);
return NULL;
@@ -142,7 +142,7 @@ structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
else {
if (len != min_len) {
PyErr_Format(PyExc_TypeError,
- "%.500s() takes a %d-sequence (%d-sequence given)",
+ "%.500s() takes a %ld-sequence (%ld-sequence given)",
type->tp_name, min_len, len);
Py_DECREF(arg);
return NULL;
@@ -200,7 +200,7 @@ structseq_concat(PyStructSequence *obj, PyObject *b)
}
static PyObject *
-structseq_repeat(PyStructSequence *obj, int n)
+structseq_repeat(PyStructSequence *obj, Py_ssize_t n)
{
PyObject *tup, *result;
tup = make_tuple(obj);
@@ -284,11 +284,11 @@ structseq_reduce(PyStructSequence* self)
}
static PySequenceMethods structseq_as_sequence = {
- (inquiry)structseq_length,
+ (lenfunc)structseq_length,
(binaryfunc)structseq_concat, /* sq_concat */
- (intargfunc)structseq_repeat, /* sq_repeat */
- (intargfunc)structseq_item, /* sq_item */
- (intintargfunc)structseq_slice, /* sq_slice */
+ (ssizeargfunc)structseq_repeat, /* sq_repeat */
+ (ssizeargfunc)structseq_item, /* sq_item */
+ (ssizessizeargfunc)structseq_slice, /* sq_slice */
0, /* sq_ass_item */
0, /* sq_ass_slice */
(objobjproc)structseq_contains, /* sq_contains */