<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/numpy/ticket/1815" rel="nofollow">http://projects.scipy.org/numpy/ticket/1815</a> on 2011-04-30 by trac user alex_lai, assigned to unknown.</em></p>
<p dir="auto">Hi experts,<br>
I’m wondering if anyone would look into this issue. While testing numpy package, Python crashed with the following error:</p>
<p dir="auto">sbtorsvr391:~ $ cd /home/dcottr/local/tests<br>
sbtorsvr391:<del>/local/tests $ export PYTHONPATH=$PYTHONPATH:</del>/local/lib/python3.1/site-packages</p>
<p dir="auto">sbtorsvr391:~/local/tests $ /usr/local/bin/python3 -c "import numpy; numpy.test()"<br>
Running unit tests for numpy<br>
NumPy version 1.5.1<br>
NumPy is installed in /home/dcottr/local/lib/python3.1/site-packages/numpy</p>
<p dir="auto">Python version 3.1.2 (r312:79147, Mar 23 2010, 02:42:06) [GCC 3.4.6]<br>
nose version 1.0.0<br>
..S...............................................................................................................................................S........Warning: invalid value encountered in isfinite<br>
............................................................................................................................................................................................Warning: invalid value encountered in isinf<br>
Warning: invalid value encountered in isinf<br>
......................................................................................................SSS........................K...........................................................K.....................................................................................................................................................F.F....................K.............................................................................................K...SK.F.......S...........................................................................................Segmentation Fault (core dumped)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="        Below is the stack trace from the core dump:"><pre class="notranslate"><code class="notranslate">        Below is the stack trace from the core dump:
</code></pre></div>
<h1 dir="auto">mdb core_sbtorsvr391_python3_10439_5000_1304101376_11246</h1>
<p dir="auto">Loading modules: [ libc.so.1 libavl.so.1 libuutil.so.1 ld.so.1 ]</p>
<blockquote>
<p dir="auto">::stack<br>
libc.so.1<code class="notranslate">strlen+0x50(fba55238, ffbf9ef8, ffbf9761, 0, 0, 0) libc.so.1</code>sprintf+0x40(ffbf9f18, 7fffffff, 7ffffc00, 2, 2, 1b74cc)<br>
test_array_from_pyobj_ext.so<code class="notranslate">array_from_pyobj+0x4e0(6, 17d3ec0, 1, 7, 16176c0, ff13a5a0) test_array_from_pyobj_ext.so</code>f2py_rout_wrap_call+0xbc(1, 1, 0, 17f000, fffffffe, fba65b94)<br>
PyCFunction_Call+0x90(15ff350, 1841900, 1844e90, 0, 1, 183df38)<br>
PyEval_EvalFrameEx+0x4f10(0, ffbfa1c0, 1615770, 1, 16491b0, 15ff350)<br>
PyEval_EvalCodeEx+0x874(1615770, 161ff60, 0, 160cf3c, 5, 0)<br>
function_call+0x8c(162e270, 160cf30, 0, 17f000, fffffffe, 40)<br>
PyObject_Call+0x44(162e270, 160cf30, 0, 160cf3c, 4, 16176c0)<br>
method_call+0x8c(162e270, 18418d0, 0, 1849f60, 1, 3f)<br>
PyObject_Call+0x44(176b620, 18418d0, 0, 2ed5c, 2efe0, 176b620)<br>
slot_tp_init+0x7c(176b620, 18418d0, 0, 2, 1, 16296d0)<br>
type_call+0xdc(16521a0, 18418d0, 0, 17f000, fffffffe, 3e)<br>
PyObject_Call+0x44(16521a0, 18418d0, 0, 18418d8, 1820030, 183ddbc)<br>
PyEval_EvalFrameEx+0x37b4(0, ffbfa688, 162e9b0, 1, 16259c0, 16521a0)<br>
PyEval_EvalFrameEx+0x5c98(0, ffbfa788, 16154e8, 1, 1626030, 162eb28)<br>
PyEval_EvalFrameEx+0x5c98(0, ffbfa888, 52b260, 1, 57ec00, 162e468)<br>
PyEval_EvalCodeEx+0x874(52b260, 5229c0, 0, 1808834, 2, 1ac03c)<br>
function_call+0x8c(5a36a8, 1808828, 0, 17f000, fffffffe, 3a)<br>
PyObject_Call+0x44(5a36a8, 1808828, 1825a50, 19b000, 163ab30, fe36c4)<br>
PyEval_EvalFrameEx+0x13bc(0, fe36c8, 52b2f0, 1, 526d50, 1808828)<br>
PyEval_EvalCodeEx+0x874(52b2f0, 1, 0, 1808c1c, 2, 0)<br>
function_call+0x8c(5a3738, 1808c10, 0, 17f000, fffffffe, 38)<br>
PyObject_Call+0x44(5a3738, 1808c10, 0, 1808c10, 1, 1849e50)<br>
method_call+0x8c(5a3738, 1630450, 0, 1630440, 9, 37)<br>
PyObject_Call+0x44(1612850, 1630450, 0, 193618, 2, 1612850)<br>
slot_tp_call+0x7c(163ab30, 1630450, 0, 17f000, fffffffe, 36)<br>
PyObject_Call+0x44(163ab30, 1630450, 0, 1630458, 1849e50, fe355c)<br>
PyEval_EvalFrameEx+0x37b4(0, ffbfaf78, b1e0f8, 1, a873a0, 163ab30)<br>
PyEval_EvalFrameEx+0x5c98(0, ffbfb078, b1e0b0, 1, b1db58, b1ed20)<br>
PyEval_EvalCodeEx+0x874(b1e0b0, b0e810, 0, 180b67c, 2, 1ac03c)<br>
function_call+0x8c(b1ecd8, 180b670, 0, 17f000, fffffffe, 33)<br>
PyObject_Call+0x44(b1ecd8, 180b670, 18258a0, 19b000, 163abf0, fe2f3c)<br>
PyEval_EvalFrameEx+0x13bc(0, fe2f40, b1ccc8, 1, b1a350, 180b670)<br>
PyEval_EvalCodeEx+0x874(b1ccc8, 1, 0, 1844dac, 2, 0)<br>
function_call+0x8c(b1ea50, 1844da0, 0, 17f000, fffffffe, 31)<br>
PyObject_Call+0x44(b1ea50, 1844da0, 0, 1844da0, 1, e4ddf0)<br>
method_call+0x8c(b1ea50, 16306d0, 0, 16306c0, b, 30)<br>
PyObject_Call+0x44(176b5a8, 16306d0, 0, 1ab728, 18f708, 176b5a8)<br>
slot_tp_call+0x7c(163abf0, 16306d0, 0, 17f000, fffffffe, 2f)<br>
PyObject_Call+0x44(163abf0, 16306d0, 0, 16306d8, e4ddf0, 18374d8)<br>
PyEval_EvalFrameEx+0x37b4(0, ffbfb768, b2e4e8, 1, ad9ce8, 163abf0)<br>
PyEval_EvalCodeEx+0x874(b2e4e8, b1b4b0, 0, 18087bc, 2, 1ac03c)<br>
function_call+0x8c(a00390, 18087b0, 0, 17f000, fffffffe, 2d)<br>
PyObject_Call+0x44(a00390, 18087b0, 176c810, 19b000, 165c450, 182ea24)<br>
PyEval_EvalFrameEx+0x13bc(0, 182ea28, b2e380, 1, b1ad50, 18087b0)<br>
PyEval_EvalCodeEx+0x874(b2e380, 1, 0, 176b8ac, 2, 0)<br>
function_call+0x8c(a002b8, 176b8a0, 0, 17f000, fffffffe, 2b)<br>
PyObject_Call+0x44(a002b8, 176b8a0, 0, 176b8a0, 1, e4ddf0)<br>
method_call+0x8c(a002b8, 16141b0, 0, 16141a0, 9, 2a)<br>
PyObject_Call+0x44(1612c10, 16141b0, 0, 1ab728, 18f708, 1612c10)<br>
slot_tp_call+0x7c(165c450, 16141b0, 0, 17f000, fffffffe, 29)<br>
PyObject_Call+0x44(165c450, 16141b0, 0, 16141b8, e4ddf0, 1645cf0)<br>
PyEval_EvalFrameEx+0x37b4(0, ffbfbe58, b2e4e8, 1, ad9ce8, 165c450)<br>
PyEval_EvalCodeEx+0x874(b2e4e8, b1b4b0, 0, 16296a4, 2, 1ac03c)<br>
function_call+0x8c(a00390, 1629698, 0, 17f000, fffffffe, 27)<br>
PyObject_Call+0x44(a00390, 1629698, 161f8a0, 19b000, 176a270, 124868c)<br>
PyEval_EvalFrameEx+0x13bc(0, 1248690, b2e380, 1, b1ad50, 1629698)<br>
PyEval_EvalCodeEx+0x874(b2e380, 1, 0, 16127bc, 2, 0)<br>
::quit</p>
</blockquote>
<p dir="auto">The C library used by Python is as follows:</p>
<p dir="auto">sbtorsvr391:~/local/tests $ ldd /usr/local/bin/python3|grep libc<br>
libc.so.1 =&gt;        /lib/libc.so.1<br>
/platform/SUNW,Sun-Fire-V490/lib/libc_psr.so.1</p>
<p dir="auto">sbtorsvr391:~ $ ls -l /lib/libc.so.1<br>
-rwxr-xr-x 1 root bin 1640776 Aug 10  2010 /lib/libc.so.1</p>
<p dir="auto">sbtorsvr391:~ $ pkgchk -l -p /lib/libc.so.1<br>
NOTE: Couldn't lock the package database.<br>
Pathname: /lib/libc.so.1<br>
Type: regular file<br>
Expected mode: 0755<br>
Expected owner: root<br>
Expected group: bin<br>
Expected file size (bytes): 1640776<br>
Expected sum(1) of contents: 50250<br>
Expected last modification: Aug 10 13:55:34 2010<br>
Referenced by the following packages:<br>
SUNWcslr<br>
Current status: installed</p>
<p dir="auto">sbtorsvr391:~ $ pkginfo -l SUNWcslr<br>
PKGINST:  SUNWcslr<br>
NAME:  Core Solaris Libraries (Root)<br>
CATEGORY:  system<br>
ARCH:  sparc<br>
VERSION:  11.10.0,REV=2005.01.21.15.53<br>
BASEDIR:  /<br>
VENDOR:  Sun Microsystems, Inc.<br>
DESC:  core software for a specific instruction-set architecture<br>
PSTAMP:  on10-patch20100511083333<br>
INSTDATE:  Jan 22 2011 16:10<br>
HOTLINE:  Please contact your local service provider<br>
STATUS:  completely installed<br>
FILES:      245 installed pathnames<br>
2 shared pathnames<br>
5 directories<br>
133 executables<br>
34303 blocks used (approx)</p>
<p dir="auto">The same problem doesn't occur when the command is run as root.</p>
<h2 dir="auto">I opened a ticket with Python support. they responsed with the comment:</h2>
<p dir="auto">The issue is actually in numpy. In numpy/f2py/src/fortranobject.c, function array_from_pyobj(), there is::</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    sprintf(mess,&quot;failed to initialize intent(inout|inplace|cache) array&quot;
            &quot; -- input must be array but got %s&quot;,
            PyString_AsString(PyObject_Str(PyObject_Type(obj)))
            );"><pre class="notranslate"><code class="notranslate">    sprintf(mess,"failed to initialize intent(inout|inplace|cache) array"
            " -- input must be array but got %s",
            PyString_AsString(PyObject_Str(PyObject_Type(obj)))
            );
</code></pre></div>
<p dir="auto">(In numpy headers, PyString_AsString is aliased to PyBytes_AsString.) Besides the reference leaks, this function will fail when given the unicode string returned by PyObject_Str(), and sprintf receives the null string...</p>
<h2 dir="auto">Please report this to numpy.</h2>
<p dir="auto">I'm hoping I will find answer to this issue here...</p>
<p dir="auto">Thanks in advance,</p>
<p dir="auto">Alex</p>
<p dir="auto">There appears to be a bug in the reference documentation. Please check and rectify.</p>
<p dir="auto">There is a None on top of the page.</p>
<p dir="auto"><a href="https://docs.scipy.org/doc/numpy/" rel="nofollow">Numpy Documentation</a></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/13755676/32979294-88b950e4-cc78-11e7-8b96-f0519dac69cb.png"><img src="https://user-images.githubusercontent.com/13755676/32979294-88b950e4-cc78-11e7-8b96-f0519dac69cb.png" alt="numpy-none" style="max-width: 100%;"></a></p>