[SciPy-dev] PyArray_CanCastSafely(exact,inexact) on 64-bit

Arnd Baecker arnd.baecker at web.de
Mon Oct 31 03:01:22 CST 2005

On Sun, 30 Oct 2005, Pearu Peterson wrote:

> After fixing the usage of PyArray_CanCastSafely, now all scipy tests,
> except one, are succesfull on a 64-bit machine:
> ======================================================================
> ERROR: check_integer
> (scipy.io.array_import.test_array_import.test_read_array)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>    File
> "/usr/local/lib/python2.3/site-packages/scipy/io/tests/test_array_import.py",
> line 62, in check_integer
>      b = io.read_array(fname,atype=N.Int)
>    File "/usr/local/lib/python2.3/site-packages/scipy/io/array_import.py",
> line 359, in read_array
>      raise ValueError, "One of the array types is invalid, k=%d" % k
> ValueError: One of the array types is invalid, k=0
> ----------------------------------------------------------------------
> Ran 1334 tests in 57.772s
> FAILED (errors=1)

That is great news! I also get this on my 64 Bit machine!

Just in case it has fallen through the cracks:
Concerning the check_integer problem:

    def check_integer(self):
        from scipy import stats
        a = stats.randint.rvs(1,20,size=(3,4))
        fname = tempfile.mktemp('.dat')
        b = io.read_array(fname,atype=N.Int)

Executing this line by line shows the error for
  b = io.read_array(fname,atype=N.Int)

  b = io.read_array(fname)
reads in the array, but it gives floats.

  b = io.read_array(fname,atype=N.Int32)

If this is the intended behaviour (also on 32Bit),
the unit test should be changed accordingly...

BTW: wouldn't io be much better in newcore instead
of newscipy? It seems like something of very common use.

Best, Arnd

More information about the Scipy-dev mailing list