<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 25, 2017 at 10:08 PM, Jaime Fernández del Río <span dir="ltr"><<a href="mailto:jaime.frio@gmail.com" target="_blank">jaime.frio@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">While working in scipy.ndimage I tried to replace the following code, <a href="https://github.com/scipy/scipy/blob/master/scipy/ndimage/src/ni_support.c#L95" target="_blank">see here</a> for the source:<div><br></div><div><font face="monospace, monospace">npy_intp max_lines;</font></div><div><font face="monospace, monospace">int ii;</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">for (ii = 0; ii < array->nd; ii++)</font></div><div><font face="monospace, monospace"> max_lines *= array->dimensions[ii];</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">with the in theory equivalent:</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="monospace, monospace">max_lines = PyArray_SIZE(array);</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Oddly enough, the result is a segfault as soon as </font><font face="monospace, monospace">PyArray_SIZE</font><font face="arial, helvetica, sans-serif"> is called, e.g. by running the ndimage tests.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Both numpy and scipy are the latest development versions, built by myself on OSX. Unfortunately I don't have Python and friends built with debug symbols, so the best I have been able to figure out, through printf debugging, is that the segfault happens before </font><font face="monospace, monospace">PyArray_MultiplyList</font><font face="arial, helvetica, sans-serif"> is entered, which made me suspicious of it being</font><font face="arial, helvetica, sans-serif"> related to </font><font face="monospace, monospace">import_array()</font><font face="arial, helvetica, sans-serif"> not being called, but that doesn't seem to be the case.</font></div></div></blockquote><div><br></div><div>Maybe you check the array of pointers that is supposed to be populated by import_array. If the entries are NULL, you know it is caused by a failure at that level.</div><div><br></div><div>David</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Any thoughts on what may be causing this?<span class="HOEnZb"><font color="#888888"><br clear="all"></font></span></font><span class="HOEnZb"><font color="#888888"><div><br></div><div>Jaime</div><div><br></div>-- <br><div class="m_200187554157393737gmail_signature">(\__/)<br>( O.o)<br>( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes de dominación mundial.</div>
</font></span></div></div>
<br>______________________________<wbr>_________________<br>
SciPy-Dev mailing list<br>
<a href="mailto:SciPy-Dev@python.org">SciPy-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-dev" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/scipy-dev</a><br>
<br></blockquote></div><br></div></div>