[Numpy-discussion] Strange PyArray_FromObject() behavior

Charles R Harris charlesr.harris at gmail.com
Fri Feb 17 01:50:24 EST 2012


On Thu, Feb 16, 2012 at 10:09 AM, Spotz, William F <wfspotz at sandia.gov>wrote:

>  I have a user who is reporting tests that are failing on his platform.
>  I have not been able to reproduce the error on my system, but working with
> him, we have isolated the problem to unexpected results when
> PyArray_FromObject() is called.  Here is the chain of events:
>
>  In python, an integer is calculated.  Specifically, it is
>
>      len(result.errors) + len(result.failures)
>
>  where result is a unit test result object from the unittest module.  I
> had him verify that this value was in fact a python integer.  In my
> extension module, this PyObject gets passed to the PyArray_FromObject()
> function in a routine that comes from numpy.i.  What I expect, and what I
> typically get, is a numpy scalar array of type C long.  I had my user print
> the result using PyObject_Print() and what he got was
>
>      array([0:00:00], dtype=timedelta64[us])
>
>
That's strange. Is the output always a zero and the type a timedelta64? In
the absence of better info I'd quess a stray pointer or, unlikely, byte
order. The numpy version would be nice to know. If you have an old version
of numpy you could also give it a shot to see what happens.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120216/f09f1d47/attachment.html>


More information about the NumPy-Discussion mailing list