Cleanup code a bit and return as early as possible.
{
int res;
if (v == Py_None)
- res = 0;
+ return 0;
else if (v->ob_type->tp_as_number != NULL &&
v->ob_type->tp_as_number->nb_nonzero != NULL)
res = (*v->ob_type->tp_as_number->nb_nonzero)(v);
v->ob_type->tp_as_sequence->sq_length != NULL)
res = (*v->ob_type->tp_as_sequence->sq_length)(v);
else
- res = 1;
- if (res > 0)
- res = 1;
- return res;
+ return 1;
+ return (res > 0) ? 1 : res;
}
/* equivalent of 'not v'