[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1
report at bugs.python.org
Fri Feb 27 02:09:38 CET 2009
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
> the question is why would the second int() return an int,
> if it's indeed a long?
Python doesn't convert long to int even if the long can fit in an int.
Even if 1L and 2L can fit in a int, Python keeps the long type.
> why the difference in this behavior between 2.5.1 and 2.5.2
No idea. You can simplify your test script with :
# example with python 2.5.1 (32 bits CPU)
On a 64 bits CPU, sys.maxint is much bigger, so don't have the problem
with -2147483648 but with -9223372036854775808:
# example with python 2.5.2 (*64 bits CPU*)
>>> sys.maxint + 1
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list