summaryrefslogtreecommitdiffstats
path: root/Objects/rangeobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-09-28 15:51:32 (GMT)
committerGuido van Rossum <guido@python.org>1994-09-28 15:51:32 (GMT)
commit03093a248d4ef3af23a5906dea276c01e0c1ae2c (patch)
treef58e5149812f94b2df57e1be321f227a5236ead6 /Objects/rangeobject.c
parent2929527aede2eab56d39cf5f5244f997479cfe9d (diff)
downloadcpython-03093a248d4ef3af23a5906dea276c01e0c1ae2c.zip
cpython-03093a248d4ef3af23a5906dea276c01e0c1ae2c.tar.gz
cpython-03093a248d4ef3af23a5906dea276c01e0c1ae2c.tar.bz2
* Include/classobject.h, Objects/classobject.c, Python/ceval.c:
entirely redone operator overloading. The rules for class instances are now much more relaxed than for other built-in types (whose coerce must still return two objects of the same type) * Objects/floatobject.c: add overflow check when converting float to int and implement truncation towards zero using ceil/float * Objects/longobject.c: change ValueError to OverflowError when converting to int * Objects/rangeobject.c: modernized * Objects/stringobject.c: use HAVE_LIMITS instead of __STDC__ * Objects/xxobject.c: changed to use new style (not finished?)
Diffstat (limited to 'Objects/rangeobject.c')
-rw-r--r--Objects/rangeobject.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index f19dad8..5f9da1d 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -1,6 +1,6 @@
/***********************************************************
-Copyright 1991, 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
+Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum,
+Amsterdam, The Netherlands.
All Rights Reserved
@@ -105,7 +105,7 @@ range_repr(r)
rangeobject *r;
{
char buf[80];
- sprintf(buf, "(range(%ld, %ld, %ld) * %d)",
+ sprintf(buf, "(xrange(%ld, %ld, %ld) * %d)",
r->start,
r->start + r->len * r->step,
r->step,
@@ -222,7 +222,7 @@ range_getattr(r, name)
char *name;
{
static struct methodlist range_methods[] = {
- {"tolist", range_tolist},
+ {"tolist", (method)range_tolist},
{NULL, NULL}
};
@@ -230,11 +230,11 @@ range_getattr(r, name)
}
static sequence_methods range_as_sequence = {
- range_length, /*sq_length*/
- range_concat, /*sq_concat*/
- range_repeat, /*sq_repeat*/
- range_item, /*sq_item*/
- range_slice, /*sq_slice*/
+ (inquiry)range_length, /*sq_length*/
+ (binaryfunc)range_concat, /*sq_concat*/
+ (intargfunc)range_repeat, /*sq_repeat*/
+ (intargfunc)range_item, /*sq_item*/
+ (intintargfunc)range_slice, /*sq_slice*/
0, /*sq_ass_item*/
0, /*sq_ass_slice*/
};
@@ -245,12 +245,12 @@ typeobject Rangetype = {
"xrange", /* Name of this type */
sizeof(rangeobject), /* Basic object size */
0, /* Item size for varobject */
- range_dealloc, /*tp_dealloc*/
- range_print, /*tp_print*/
- range_getattr, /*tp_getattr*/
+ (destructor)range_dealloc, /*tp_dealloc*/
+ (printfunc)range_print, /*tp_print*/
+ (getattrfunc)range_getattr, /*tp_getattr*/
0, /*tp_setattr*/
- range_compare, /*tp_compare*/
- range_repr, /*tp_repr*/
+ (cmpfunc)range_compare, /*tp_compare*/
+ (reprfunc)range_repr, /*tp_repr*/
0, /*tp_as_number*/
&range_as_sequence, /*tp_as_sequence*/
0, /*tp_as_mapping*/