Kaydet (Commit) 0bff015a authored tarafından Guido van Rossum's avatar Guido van Rossum

Added nonzero test

üst 50b4ef64
...@@ -328,6 +328,13 @@ int_abs(v) ...@@ -328,6 +328,13 @@ int_abs(v)
return int_neg(v); return int_neg(v);
} }
static int
int_nonzero(v)
intobject *v;
{
return v->ob_ival != 0;
}
static number_methods int_as_number = { static number_methods int_as_number = {
int_add, /*nb_add*/ int_add, /*nb_add*/
int_sub, /*nb_subtract*/ int_sub, /*nb_subtract*/
...@@ -339,6 +346,7 @@ static number_methods int_as_number = { ...@@ -339,6 +346,7 @@ static number_methods int_as_number = {
int_neg, /*nb_negative*/ int_neg, /*nb_negative*/
int_pos, /*nb_positive*/ int_pos, /*nb_positive*/
int_abs, /*nb_absolute*/ int_abs, /*nb_absolute*/
int_nonzero, /*nb_nonzero*/
}; };
typeobject Inttype = { typeobject Inttype = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment