[Python-Dev] int(string)

Fredrik Lundh fredrik at pythonware.com
Mon Oct 24 09:41:39 CEST 2005


Alan McIntyre wrote:

> When running "make test" I get some errors in test_array and
> test_compile that did not occur in the build from CVS.  Given the inputs
> to long() have '.' characters in them, I assume that these tests really
> should be failing as implemented, but I haven't dug into them to see
> what's going on:
>
> ======================================================================
> ERROR: test_repr (__main__.FloatTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "Lib/test/test_array.py", line 187, in test_repr
>     self.assertEqual(a, eval(repr(a), {"array": array.array}))
> ValueError: invalid literal for long(): 10000000000.0
>
> ======================================================================
> ERROR: test_repr (__main__.DoubleTest)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "Lib/test/test_array.py", line 187, in test_repr
>     self.assertEqual(a, eval(repr(a), {"array": array.array}))
> ValueError: invalid literal for long(): 10000000000.0

I don't have the latest cvs, but in my copy of test_array, the input to those
two eval calls are

 array('f', [-42.0, 0.0, 42.0, 100000.0, -10000000000.0, -42.0, 0.0, 42.0,
        100000.0, -10000000000.0])

and

 array('d', [-42.0, 0.0, 42.0, 100000.0, -10000000000.0, -42.0, 0.0, 42.0,
        100000.0, -10000000000.0])

respectively.  if either of those gives "invalid literal for long", something's
seriously broken.

does a plain

    a = -10000000000.0

still work on your machine?

</F>





More information about the Python-Dev mailing list