mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Added nonzero test
This commit is contained in:
parent
50b4ef64eb
commit
0bff015ac3
1 changed files with 8 additions and 0 deletions
|
@ -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 = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue