summaryrefslogtreecommitdiffstats
path: root/Objects/intobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-05-14 12:05:32 (GMT)
committerGuido van Rossum <guido@python.org>1991-05-14 12:05:32 (GMT)
commit0bff015ac304fcfd316d2c63c0532471250691e6 (patch)
tree804fd5fa8047a8c6e128c7125f65a14afe1735aa /Objects/intobject.c
parent50b4ef64eb745902ac9c88427646b8005d4b97e9 (diff)
downloadcpython-0bff015ac304fcfd316d2c63c0532471250691e6.zip
cpython-0bff015ac304fcfd316d2c63c0532471250691e6.tar.gz
cpython-0bff015ac304fcfd316d2c63c0532471250691e6.tar.bz2
Added nonzero test
Diffstat (limited to 'Objects/intobject.c')
-rw-r--r--Objects/intobject.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Objects/intobject.c b/Objects/intobject.c
index eeb4038..6e48a27 100644
--- a/Objects/intobject.c
+++ b/Objects/intobject.c
@@ -328,6 +328,13 @@ int_abs(v)
return int_neg(v);
}
+static int
+int_nonzero(v)
+ intobject *v;
+{
+ return v->ob_ival != 0;
+}
+
static number_methods int_as_number = {
int_add, /*nb_add*/
int_sub, /*nb_subtract*/
@@ -339,6 +346,7 @@ static number_methods int_as_number = {
int_neg, /*nb_negative*/
int_pos, /*nb_positive*/
int_abs, /*nb_absolute*/
+ int_nonzero, /*nb_nonzero*/
};
typeobject Inttype = {