[Python-Dev] ints not overflowing into longs? (original) (raw)

Victor Stinner victor.stinner at haypocalc.com
Thu Nov 3 13:00:18 CET 2011


Le Mercredi 2 Novembre 2011 19:32:38 Derek Shockey a écrit :

I just found an unexpected behavior and I'm wondering if it is a bug. In my 2.7.2 interpreter on OS X, built and installed via MacPorts, it appears that integers are not correctly overflowing into longs and instead are yielding bizarre results. I can only reproduce this when using the exponent operator with two ints (declaring either operand explicitly as long prevents the behavior).

>>> 2**100 0

This issue has already been fixed twice in Python 2.7 branch: int_pow() has been fixed and -fwrapv is now used for Clang.

http://bugs.python.org/issue11149 http://bugs.python.org/issue12973

It is maybe time for a new release? :-)

Victor



More information about the Python-Dev mailing list