[issue1533] Bug in range() function for large values
Mark Dickinson
report at bugs.python.org
Sat May 1 22:03:09 CEST 2010
Mark Dickinson <dickinsm at gmail.com> added the comment:
A couple of suggestions regarding the patch:
(1) I'd suggest leaving the first part of handle_range_longs intact, up to and including the "/* ilow and ihigh correct now; do istep */" block. Then build out the three "if (!PyInt_Check(...)) ..." blocks below to include argument conversion. I think the patch would look cleaner this way.
(2) Rather than using PyNumber_Long, I'd prefer an explicit check for, and call to, nb_int. This is the behaviour that's used for the 'l' getargs format. PyNumber_Long is considerably more complicated, and involves looking at __trunc__ and __long__; so if you use PyNumber_Long you'll still end up with inconsistent behaviour between small and large arguments.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1533>
_______________________________________
More information about the Python-bugs-list
mailing list