[issue3439] create a numbits() method for int and long types
Mark Dickinson
report at bugs.python.org
Fri Dec 12 19:10:46 CET 2008
Mark Dickinson <dickinsm at gmail.com> added the comment:
> I choosed to use consistent result type. But now I would prefer int :-) I see
> that PyInt_FromSize_t() returns a long if the value doesn't fit in an int. So
> it's correct.
Cool. I think int is better, simply because the result is almost always going to fit
into an int in practice, and because calculations with ints are faster.
> I'm paranoid
Yeah, me too. I removed the check, but also changed the assert to check that
Py_SIZE is nonzero.
> Can you fix these two issues (use PyInt_FromSize_t and remove the if)?
Done.
Added file: http://bugs.python.org/file12332/numbits-6b.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3439>
_______________________________________
More information about the Python-bugs-list
mailing list