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

Derek Shockey derek.shockey at gmail.com
Thu Nov 3 05:37:02 CET 2011


Thank you, I narrowed it down from there and got a properly working build. I gather the problem is that in Xcode 4.2 the default compiler was changed to clang, but the version of clang bundled with it has a bug that breaks overflows in intobject.c.

In case anyone else hits this, I fixed this in MacPorts by forcing it to use gcc. Edit the portfile (port edit python27) and add this anywhere after the 5th or so line: configure.compiler llvm-gcc-4

-Derek

On Wed, Nov 2, 2011 at 7:41 PM, Guido van Rossum <guido at python.org> wrote:

Apparently Macports is still using a buggy compiler. I reported a similar issue before and got this reply from Ned Delly:

""" Thanks for the pointer.  That looks like a duplicate of Issue11149 (and Issue12701).  Another manifestation of this was reported in Issue13061 which also originated from MacPorts.  I'll remind them that the configure change is likely needed for all Pythons.  It's still safest to stick with good old gcc-4.2 on OS X at the moment. """ (Those issues are on bugs.python.org.) --Guido On Wed, Nov 2, 2011 at 7:32 PM, Derek Shockey <derek.shockey at gmail.com> wrote: 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 2**100L 1267650600228229401496703205376L 20**20 -2101438300051996672 20L**20 104857600000000000000000000L 10**20 7766279631452241920 10L**20L 100000000000000000000L To confirm I'm not crazy, I tried in the 2.7.1 and 2.6.7 installations included in OS X 10.7, and also a 2.7.2+ (not sure what the + is) on an Ubuntu machine and didn't see this behavior. This looks like some kind of truncation error, but I don't know much about the internals of Python and have no idea what's going on. I assume since it's only in my MacPorts installation, it must be build configuration issue that is specific to OS X, perhaps only 10.7, or MacPorts. Am I doing something wrong, and is there a way to fix it before I compile? I could find any references to this problem as a known issue. Thanks, Derek


Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org

-- --Guido van Rossum (python.org/~guido)



More information about the Python-Dev mailing list