<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 26, 2017 at 9:08 AM, 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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>Even if it's not the cause here, that ``#undef NO_IMPORT_ARRAY`` looks quite odd, it's the only place in scipy or numpy where that is done. May be good to get rid of it.<br><br></div><div>Ralf<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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="gmail-HOEnZb"><font color="#888888"><br clear="all"></font></span></font><span class="gmail-HOEnZb"><font color="#888888"><div><br></div><div>Jaime</div><div><br></div>-- <br><div class="gmail-m_1964884257374840836gmail_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>