[issue11144] int(float) may return a long for no reason
Mark Dickinson
report at bugs.python.org
Wed Feb 9 21:40:09 CET 2011
Mark Dickinson <dickinsm at gmail.com> added the comment:
This turns out to be a one-line fix (modulo comments and tests); see attached patch. The new code depends on the assumption that C longs are represented using two's complement, but note that this assumption is (a) already present elsewhere in the Python core (e.g., in the definition of bitwise operations for ints), and (b) universally true in practice (as far as I'm aware). For theoretical completeness, it would be easy to write a different test for ones' complement and sign-magnitude machines, but in practice that seems pointless, and given the near-impossibility of testing that code, I left it out.
----------
keywords: +patch
Added file: http://bugs.python.org/file20724/issue11144.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11144>
_______________________________________
More information about the Python-bugs-list
mailing list