[Numpy-discussion] test_multiarray.TestIO.test_ascii segmentation fault with Python2.7

Bruce Southey bsouthey@gmail....
Tue Dec 15 10:46:26 CST 2009


On 12/15/2009 10:07 AM, Pauli Virtanen wrote:

[snip]
> Please also test the 1.4.x branch
>
> 	http://svn.scipy.org/svn/numpy/branches/1.4.x
>
> Does it fail too on Python 2.7? There are very few code changes since
> 1.4.x on the path that the test exercises.
>
>    
This took a little time find to the test because asbytes appears to be 
new in SVN.

Anyhow, numpy 1.4.0rc1 works with  Python 2.6  but not Python 2.7:
$ python2.6
Python 2.6.1 (r261:532, May  7 2009, 11:38:00)
[GCC 4.3.2 20081105 (Red Hat 4.3.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy as np
 >>> np.__version__
'1.4.0rc1'
 >>> np.fromstring('1,2,3,4',sep=',')
array([ 1.,  2.,  3.,  4.])
 >>>


$ python2.7
Python 2.7a1 (r27a1:76674, Dec 14 2009, 13:46:01)
[GCC 4.4.1 20090725 (Red Hat 4.4.1-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy as np
 >>> np.__version__
'1.4.0rc1'
 >>> np.fromstring('1,2,3,4',sep=',')
Segmentation fault


$ gdb --args python
GNU gdb (GDB) Fedora (6.8.50.20090302-39.fc11)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) run
Starting program: /usr/local/bin/python
[Thread debugging using libthread_db enabled]
Python 2.7a1 (r27a1:76674, Dec 14 2009, 13:46:01)
[GCC 4.4.1 20090725 (Red Hat 4.4.1-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy as np
 >>> np.__version__
'1.4.0rc1'
 >>> from numpy.compat import asbytes, getexception
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ImportError: cannot import name asbytes
 >>> s='1,2,3,4'
 >>> np.fromstring('1,2,3,4',sep=',')

Program received signal SIGSEGV, Segmentation fault.
setup_context (registry=<value optimized out>, module=<value optimized 
out>, lineno=<value optimized out>, filename=<value optimized out>, 
stack_level=<value optimized out>)
     at Python/_warnings.c:449
449         PyFrameObject *f = PyThreadState_GET()->frame;
(gdb) bt
#0  setup_context (registry=<value optimized out>, module=<value 
optimized out>, lineno=<value optimized out>, filename=<value optimized 
out>, stack_level=<value optimized out>)
     at Python/_warnings.c:449
#1  do_warn (registry=<value optimized out>, module=<value optimized 
out>, lineno=<value optimized out>, filename=<value optimized out>, 
stack_level=<value optimized out>)
     at Python/_warnings.c:593
#2  0x0000000000493c81 in PyErr_WarnEx (category=0x760720, text=<value 
optimized out>, stack_level=1) at Python/_warnings.c:719
#3  0x00000000004c8e94 in PyOS_ascii_strtod (nptr=0x7ffff7f16624 
"1,2,3,4", endptr=0x7fffffffdb28) at Python/pystrtod.c:282
#4  0x00007ffff2955791 in NumPyOS_ascii_strtod (s=0x7ffff7f16624 
"1,2,3,4", endptr=0x7fffffffdb28) at numpy/core/src/multiarray/numpyos.c:518
#5  0x00007ffff295580c in DOUBLE_fromstr (str=0x7ffff7ef14b0 "\1", 
ip=0xc42de0, endptr=0x0, __NPY_UNUSED_TAGGEDignore=0x6920656c62756f64)
     at numpy/core/src/multiarray/arraytypes.c.src:1549
#6  0x00007ffff2939397 in fromstr_next_element (s=0x7fffffffdb28, 
dptr=0x760720, dtype=<value optimized out>, end=0x7ffff7f1662b "") at 
numpy/core/src/multiarray/ctors.c:33
#7  0x00007ffff296291a in array_from_text (dtype=0x7ffff2bbd3e0, 
num=<value optimized out>, sep=<value optimized out>, 
nread=0x7fffffffdbb8, stream=0x7ffff7f16624,
     next=<value optimized out>, skip_sep=0x7ffff294d360 
<fromstr_skip_separator>, stream_data=0x7ffff7f1662b) at 
numpy/core/src/multiarray/ctors.c:2927
#8  0x00007ffff2962b31 in PyArray_FromString (data=0x7ffff7f16624 
"1,2,3,4", slen=<value optimized out>, dtype=0x7ffff2bbd3e0, num=-1, 
sep=0x0)
     at numpy/core/src/multiarray/ctors.c:3234
#9  0x00007ffff2962caf in array_fromstring 
(__NPY_UNUSED_TAGGEDignored=<value optimized out>, args=<value optimized 
out>, keywds=<value optimized out>)
     at numpy/core/src/multiarray/multiarraymodule.c:1684
#10 0x00000000004a03c0 in do_call (nk=<value optimized out>, na=-1, 
pp_stack=<value optimized out>, func=<value optimized out>) at 
Python/ceval.c:4194
#11 call_function (nk=<value optimized out>, na=-1, pp_stack=<value 
optimized out>, func=<value optimized out>) at Python/ceval.c:4002
#12 PyEval_EvalFrameEx (nk=<value optimized out>, na=-1, pp_stack=<value 
optimized out>, func=<value optimized out>) at Python/ceval.c:2618
#13 0x00000000004a12a6 in PyEval_EvalCodeEx (co=0x7ffff7ef3738, 
globals=<value optimized out>, locals=<value optimized out>, args=0x0, 
argcount=1702130542,
     kws=<value optimized out>, kwcount=0, defs=0x0, defcount=0, 
closure=0x0) at Python/ceval.c:3209
#14 0x00000000004a1372 in PyEval_EvalCode (co=0x7ffff7ef14b0, 
globals=0x760720, locals=0x0) at Python/ceval.c:666
#15 0x00000000004c0047 in run_mod (arena=<value optimized out>, 
flags=<value optimized out>, locals=<value optimized out>, 
globals=<value optimized out>,
     filename=<value optimized out>, mod=<value optimized out>) at 
Python/pythonrun.c:1342
#16 PyRun_InteractiveOneFlags (arena=<value optimized out>, flags=<value 
optimized out>, locals=<value optimized out>, globals=<value optimized out>,
     filename=<value optimized out>, mod=<value optimized out>) at 
Python/pythonrun.c:847
#17 0x00000000004c024e in PyRun_InteractiveLoopFlags (fp=0x34ecf686a0, 
filename=0x5161a8 "<stdin>", flags=0x7fffffffdff0) at Python/pythonrun.c:767
#18 0x00000000004c094b in PyRun_AnyFileExFlags (fp=0x34ecf686a0, 
filename=0x5161a8 "<stdin>", closeit=0, flags=0x7fffffffdff0) at 
Python/pythonrun.c:736
#19 0x0000000000414334 in Py_Main (argc=0, argv=<value optimized out>) 
at Modules/main.c:576
#20 0x00000034ecc1ea2d in __libc_start_main (main=<value optimized out>, 
argc=<value optimized out>, ubp_av=<value optimized out>, init=<value 
optimized out>,
     fini=<value optimized out>, rtld_fini=<value optimized out>, 
stack_end=0x7fffffffe108) at libc-start.c:220
#21 0x0000000000413619 in _start ()


More information about the NumPy-Discussion mailing list