[Python-bugs-list] [ python-Bugs-678375 ] test_long fails

SourceForge.net noreply@sourceforge.net
Fri, 31 Jan 2003 12:44:05 -0800


Bugs item #678375, was opened at 2003-01-31 20:44
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=678375&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Michael Stone (mbrierst)
Assigned to: Nobody/Anonymous (nobody)
Summary: test_long fails

Initial Comment:

on linux kernel 2.2.17, libc2.2

this code demonstrates the problem:

s='12345'*1000
float(s)

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ValueError: invalid literal for float(): 1234512...

caused by PyFloat_FromString in floatobject.c:
Testing shows strtod only reads the first 721 digits of the string it gets (after any leading zeros).  Python then thinks the remaining digits aren't valid because strtod did not process them, even though strtod returned inf as is proper.  I guess this is a strtod problem, maybe it depends on the version of libc?

PyFloat_FromString could deal with this case, but really only correctly if it reimpliments strtod, as there could be an exponent way on the end of the string.  I don't know what the correct solution to this is, but surely something should at least be done about the failed test.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=678375&group_id=5470