]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added nonzero test
authorGuido van Rossum <guido@python.org>
Tue, 14 May 1991 12:05:32 +0000 (12:05 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 14 May 1991 12:05:32 +0000 (12:05 +0000)
Objects/intobject.c

index eeb403885a9e4c7924e6d4b357a0c517d5bc3319..6e48a27cd35b912d148aea39da294b3551028a54 100644 (file)
@@ -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 = {