<br><br><div class="gmail_quote">On Thu, Feb 16, 2012 at 10:09 AM, Spotz, William F <span dir="ltr"><<a href="mailto:wfspotz@sandia.gov">wfspotz@sandia.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
<div style="font-family:Calibri,sans-serif;font-size:14px">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:</div>
<div style="font-family:Calibri,sans-serif;font-size:14px"><br>
</div>
<div style="font-family:Calibri,sans-serif;font-size:14px">In python, an integer is calculated. Specifically, it is</div>
<div style="font-family:Calibri,sans-serif;font-size:14px"><br>
</div>
<div style="font-family:Calibri,sans-serif"><span style="font-family:Monaco;font-size:12px"> len(result.errors) + len(result.failures)</span></div>
<div style="font-family:Calibri,sans-serif;font-size:14px"><br>
</div>
<div style="font-family:Calibri,sans-serif;font-size:14px">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</div>
<div style="font-family:Calibri,sans-serif;font-size:14px"><br>
</div>
<div style="font-family:Calibri,sans-serif"><span style="font-size:12px"><span style="font-family:Monaco"> </span><span style="font-family:Monaco">array([0:00:00], dtype=timedelta64[us])</span></span></div>
<span style="font-size:medium;font-family:Calibri"><br></span></div></blockquote><div><br>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.<br>
<br>Chuck<br></div><br></div>