Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 12554 - python 2.2.2 => OverflowError: float too large to convert
Summary: python 2.2.2 => OverflowError: float too large to convert
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: x86 Linux
: High critical with 1 vote (vote)
Assignee: Bart Lauwers (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on: 11193
Blocks: 13396
  Show dependency tree
 
Reported: 2002-12-22 04:17 UTC by Cong
Modified: 2003-02-04 19:42 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
the WORLD file (world,1.51 KB, text/plain)
2003-01-20 21:41 UTC, Cong
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cong 2002-12-22 04:17:07 UTC
When using idle.py I got next erro, so I belive that this is a bug inside Python
2.2.2

A similar error happens when you import LinearAlgebra (in Numeric) from the prompt.

Python 2.2.2 (#1, Dec 22 2002, 17:44:21) 
[GCC 3.2.1] on linux2
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
>>> Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.2/lib-tk/Tkinter.py", line 1300, in __call__
    return apply(self.func, args)
  File "/usr/lib/python2.2/tools/idle/TreeWidget.py", line 124, in flip
    self.item.OnDoubleClick()
  File "/usr/lib/python2.2/tools/idle/ClassBrowser.py", line 206, in OnDoubleClick
    edit.gotoline(self.cl.methods[self.name])
  File "/usr/lib/python2.2/tools/idle/EditorWindow.py", line 397, in gotoline
    self.center()
  File "/usr/lib/python2.2/tools/idle/EditorWindow.py", line 488, in center
    top, bot = self.getwindowlines()
  File "/usr/lib/python2.2/tools/idle/EditorWindow.py", line 497, in getwindowlines
    bot = self.getlineno("@0,65535")
  File "/usr/lib/python2.2/tools/idle/EditorWindow.py", line 506, in getlineno
    return int(float(text.index(mark)))
OverflowError: float too large to convert
Comment 1 Bardur Arantsson 2002-12-31 07:08:02 UTC
This looks like a very strange bug indeed. The bug is very simple to demonstrate (for me at least):     $ python    Python 2.2.2 (#1, Dec 31 2002, 13:29:44)    [GCC 3.2.1 20021207 (Gentoo Linux 3.2.1-20021207)] on linux2    Type "help", "copyright", "credits" or "license" for more information.    >>> int(2.2)    0    >>> int(4)    4    >>> int(5.4)    0    >>> int(10.2)    Traceback (most recent call last):      File "<stdin>", line 1, in ?    OverflowError: float too large to convert    >>>^D  I've tried compiling python with the following sets of CFLAGS:     CFLAGS="-march=pentium4 -O3 -pipe"    CFLAGS="-mcpu=pentium4 -O3 -pipe"    CFLAGS="-O2 -pipe  (this is all with gcc-3.2.1-r6 of the "unstable" gentoo portage).  
Comment 2 Cong 2003-01-03 20:14:03 UTC
Subject: Re: [gentoo-user] int(float(1)) == 0 ? in Python 2.2.2
From: Nicholas Hockey <tilt@bluecherry.net>
To: gentoo-user@gentoo.org
Date: 02 Jan 2003 01:13:40 -0500
X-Mew: Text/Html in Multipart/Alternative as a singlepart
       Text/Html in Multipart/Alternative as a singlepart
       Text/Html in Multipart/Alternative as a singlepart
X-Mew: <8 body> No his/her public key. ID = not found
X-Mew: <12 body> No his/her public key. ID = not found
X-Mew: <14 body> No his/her public key. ID = not found

I think you got bit by a gcc-3 bug,
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8988
we got similare seg faults in BitchX, and if you notice the one of three ppl who
said it worked
fine, was the one using an odd version of gcc, i compiled it with the optamizer
flags set to -O3
-march=i686 which defuses the bug... another quick fix would be putting
-fno-strength-reduce in
your CFLAGS till you can upgrade

[tilt@blackhole] ~ > python
Python 2.2.2 (#1, Dec 10 2002, 14:18:33)
[GCC 3.2.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> int(1)
1
>>> int(1.0)
1
>>> int(9.01754349826526)
9
>>> int(9.01754)
9
>>> int(10)
10
>>>

On Sun, 2002-12-29 at 23:44, Cong wrote:

    Could you help me to figure out what happened !
    
    $ python
    Python 2.2.2 (#1, Dec 30 2002, 13:03:14) 
    [GCC 3.2.1] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> int(1)
    1
    >>> int(1.0)
    0
    >>> int(9.01754349826526)
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    OverflowError: float too large to convert
    >>> int(9.01754)
    0
    >>> int(10)
    10
    >>>
    
 
Comment 3 Rob 2003-01-07 18:47:12 UTC
The int() bug is a showstopper for me doing any Python development on Gentoo.

I also tried using -march-i686 -O3, and that didn't help any.  Rob.
Comment 4 Bart Lauwers (RETIRED) gentoo-dev 2003-01-19 16:23:43 UTC
Ok, can you please attach the output of 'emerge info'? thanks!
Comment 5 Cong 2003-01-19 20:50:21 UTC
# emerge info 
Portage 2.0.46-r9 (default-x86-1.4, gcc-3.2.1, glibc-2.3.1-r2) 
================================================================= 
System uname: 2.4.20-gentoo-r1 i686 Intel(R) Pentium(R) 4 CPU 2.40GHz 
GENTOO_MIRRORS="http://www.ibiblio.org/pub/Linux/distributions/gentoo" 
CONFIG_PROTECT="/etc /var/qmail/control /usr/kde/2/share/config 
/usr/X11R6/lib/X11/xkb /usr/kde/3.1/share/config /usr/kde/3/share/config 
/usr/share/config" 
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" 
PORTDIR="/usr/portage" 
DISTDIR="/opt/tmp/distfiles" 
PKGDIR="/usr/portage/packages" 
PORTAGE_TMPDIR="/opt/tmp" 
PORTDIR_OVERLAY="/opt/portage" 
USE="x86 oss apm avi crypt cups encode gif jpeg libg++ mmx mpeg nls pdflib png 
quicktime spell truetype xmms xv zlib directfb gtkhtml alsa readline arts tetex aalib 
nas bonobo tcltk java guile ruby X gpm tcpd pam libwww ssl perl python esd gnome 
gtk qt kde opengl mozilla gphoto2 cdr scanner -3dnow acpi atlas -berkdb canna cjk 
dvd freewnn -gdbm icc icc-pgo imap -imlib jikes leim maildir mbox -mikmod -motif 
mule -ncurses oav -oggvorbis pic plotutils pnp -qtmt -sdl -slang slp sse -svga tiff 
wmf -xml2" 
COMPILER="gcc3" 
CHOST="i686-pc-linux-gnu" 
CFLAGS="-O3 -march=pentium4 -pipe -fomit-frame-pointer" 
CXXFLAGS="-O3 -march=pentium4 -pipe -fomit-frame-pointer" 
ACCEPT_KEYWORDS="x86" 
MAKEOPTS="-j2" 
AUTOCLEAN="true" 
SYNC="rsync://rsync.gentoo.org/gentoo-portage" 
FEATURES="sandbox ccache" 
 
Comment 6 Jon M. Hanson 2003-01-19 21:50:11 UTC
Could it be that the python ebuild script overrides the -O3 compiler flag with
-O2 exposing this problem?

I'm also running into this problem in the emerge of media-sound/lilypond (bug
13396).
Comment 7 Bart Lauwers (RETIRED) gentoo-dev 2003-01-20 20:22:08 UTC
Jon, If you look closely at the output of emerge python, then it is clear that
it does pass all the arguments in the CFLAGS. In fact the ebuild teaches that
only an option of "-malign-double" would be filtered out. I believe Cong has the
proper answer to this problem if only I could manage to reproduce the problem
somehow...

Cong, I've recompiled python a few times now including exactly your settings
from emerge info, I haven't been able to reproduce this issue. Have you verified
that your system is "up to date"? (The only difference between my tries and
yours is that I had to use -march=i686 since I run on an Athlon and P4 code
wouldn't run on it.)
Comment 8 Cong 2003-01-20 21:40:40 UTC
Hi ,  I'd like to keep SYSTEM and my favorite apps up-to-date.
Have a look at my /var/cache/edb/world too.

$ emerge  system -up --deep

These are the packages that I would merge, in order:

Calculating system dependencies ...done!

$ emerge world -up --deep

These are the packages that I would merge, in order:

Calculating world dependencies ...done!
[ebuild    UD] media-video/nvidia-kernel-1.0.3123-r2 [1.0.4191-r1]
[ebuild    UD] media-video/nvidia-glx-1.0.3123 [1.0.4191]
[ebuild    U ] media-libs/glut-3.7.1 [3.7-r2]
[ebuild    U ] app-text/openjade-1.3.1-r6 [1.3.1-r5]
[ebuild    UD] app-text/docbook-sgml-dtd-4.0-r1 [4.1-r1]
[ebuild  N   ] net-libs/openslp-1.0.9a
[ebuild    UD] kde-base/arts-1.0.5a [1.1.0_rc6]
[ebuild    UD] kde-base/kdelibs-3.0.5a [3.1_rc6]
[ebuild    UD] media-libs/xine-lib-0.9.13-r2 [1_beta2]
[ebuild    UD] media-libs/libpng-1.0.15 [1.2.5-r3]
[ebuild    U ] media-libs/libsdl-1.2.5-r1 [1.2.4.20020601]
[ebuild    UD] media-video/vlc-0.4.4 [0.4.5]
[ebuild    UD] app-cdr/cdrtools-1.11.33 [2.0]
[ebuild    UD] app-cdr/xcdroast-0.98_alpha10-r2 [0.98_alpha13]
[ebuild    UD] x11-wm/metacity-2.4.1 [2.4.8]
[ebuild    U ] x11-libs/wxGTK-2.4.0 [2.3.3]
[ebuild    U ] dev-python/wxPython-2.4.0.1 [2.3.3.1-r2]
[ebuild  N   ] media-video/mplayer-0.90_rc2
[ebuild    UD] dev-util/anjuta-1.0.0 [1.0.1]
[ebuild    UD] media-video/transcode-0.6.0 [0.6.3.20021205]
[ebuild    UD] media-video/dvdrip-0.46 [0.48.5]
[ebuild    UD] sys-apps/eject-2.0.10 [2.0.12]
[ebuild    U ] x11-libs/libzvt-2.0.1-r2 [2.0.1-r1]
[ebuild    U ] gnome-extra/gconf-editor-0.4.0 [0.3.1]
[ebuild  N   ] media-sound/sox-12.17.3-r3
[ebuild    UD] kde-base/kdebase-3.0.5a-r1 [3.1_rc6]
Comment 9 Cong 2003-01-20 21:41:48 UTC
Created attachment 7489 [details]
the WORLD file
Comment 10 Bardur Arantsson 2003-01-21 02:01:24 UTC
> (The only difference between my tries and yours is that I had to 
> use -march=i686 since I run on an Athlon and P4 code wouldn't run on it.) 
 
This seems to be the exact problem. I suspect that gcc-3.2.1-r7 (which 
was patched with patches that supposedly should have fixed this problem, but apparently 
didn't) is miscompiling glibc-2.3.1, which in turn causes this problem in python. 
 
I can do 
 
	jed /etc/make.conf (changing the CFLAGS to "-march=p4 -O3 ...") 
	emerge glibc python 
	<do python test> 
	jed /etc/make.conf (change CFLAGS to "-mcpu=p4 -O3 ...") 
	emerge glibc python 
	<do python test> 
 
and the int() function *will* fail in the first instance, but int() will work fine in the 
second test. So it seems that there are still problems with glibc. (I haven't actually 
tried it, but the above should also reproduce the errors without recompiling python 
since it's dynamically linked with glibc). 
 
Comment 11 Cong 2003-01-21 11:17:29 UTC
I have verified both 1 and 2 on my box:

1.
> and the int() function *will* fail in the first instance, but int() will work
fine in the 
> second test. So it seems that there are still problems with glibc. 

2.
> (I haven't actually 
> tried it, but the above should also reproduce the errors without recompiling
python 
> since it's dynamically linked with glibc). 
 
Comment 12 Martin Schlemmer (RETIRED) gentoo-dev 2003-01-24 13:46:05 UTC
Known problems with -march=pentium4 -O3 ... please recompile glibc with
"-march=pentium3 -O2 -pipe".  Its actually a gcc3 problem.

Comment 13 Cong 2003-01-24 20:25:22 UTC
With 
CFLAGS="-O3 -mcpu=pentium4 -pipe -fomit-frame-pointer"

it works too. Now I use it to compile glibc and the next for compiling others:
CFLAGS="-O3 -march=pentium4 -pipe -fomit-frame-pointer"
Comment 14 Bart Lauwers (RETIRED) gentoo-dev 2003-01-26 08:57:47 UTC
Since this has been confirmed as a gcc/libc bug I am going to close this
particular bug as it contains a workaround which will resolve the problem. This
will hopefully be corrected permanently with the next gcc/glibc release.