converting float to int issue

Tim Peters tim.one at comcast.net
Mon May 5 15:00:35 EDT 2003


[Alex]
> Python 2.2.2 (#1, Apr 16 2003, 22:00:16)
> [GCC 3.2.1 20021207 (Gentoo Linux 3.2.1-20021207)] on linux2
> >>> int(1.0)
> 0
> >>> int(3.0)
> 0
> >>> int(3.14)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> OverflowError: float too large to convert

This is usually the result of a compiler optimization bug.  Try recompiling
Python with optimization disabled.  If the problem goes away then, live with
an unoptimized Python, find the smallest subset of Python files that need
optimization disabled (likely just intobject.c), file a bug report against
the compiler, and/or try a more recent compiler.






More information about the Python-list mailing list