Open numpy-gitbot opened 11 years ago
atmention:charris wrote on 2012-02-26
I suspect this is a problem with recarray. Things work better with array:
In [59]: a = np.array([(2,2),(2,2)], dtype)
In [60]: a
Out[60]:
array([(2, 2), (2, 2)],
dtype=[('f0', '<i4'), ('f1', '<i4')])
In [61]: a.searchsorted(1)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/charris/<ipython-input-61-0a2b1f19a7e6> in <module>()
----> 1 a.searchsorted(1)
TypeError: invalid type promotion
trac user josh.ayers wrote on 2012-02-27
That also segfaults for me on Windows, with the same gdb output.
I tried both cases - with a recarray and a standard structured array - on Ubuntu 11.10 in a virtual machine. It raises a !TypeError for both, so it seems like the problem is Windows-specific. However, the !NumPy version under Ubuntu was 1.5.1, versus 1.6.1 under Windows.
For further clarification, under Windows I'm using the !NumPy binaries that come with Python(x,y) 2.7.2.1.
atmention:mwiebe wrote on 2012-03-12
NumPy should never segfault (except in the presence of funky ctypes code).
Milestone changed to NumPy 1.7
by atmention:mwiebe on 2012-03-12
trac user claumann wrote on 2012-04-11
Standard structured arrays segfault on Mac OSX with Enthought's python 2.7.2, but github numpy 2.0.0.dev-26aa3cf.
Using Fonnesbeck's current superpack (Apple Python 2.7.1 from Lion, numpy 1.7.0.dev-3503cf), the same code raises an type promotion error. Don't know if this is related to enthought or if the github master doesn't have the same type checking that 1.7.0.dev seems to have..
Python 2.7.2 |EPD 7.1-1 (64-bit)| (default, Jul 3 2011, 15:56:02) Type "copyright", "credits" or "license" for more information.
IPython 0.13.dev -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details.
Welcome to pylab, a matplotlib-based Python environment [backend: MacOSX]. For more information, type 'help(pylab)'.
In [1]: np.version Out[1]: '2.0.0.dev-26aa3cf'
In [2]: dtype = np.format_parser(['i4', 'i4'], [], [])
In [3]: a = np.array([(2,2),(2,2)], dtype)
In [4]: np.searchsorted(a, r_[1]) Segmentation fault: 11
atmention:charris wrote on 2012-04-12
Raises TypeError in current master.
In [1]: dtype = np.format_parser(['i4', 'i4'], [], [])
In [2]: a = np.recarray((2, ), dtype)
In [3]: np.searchsorted(a, 1)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1615, 0))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/charris/<ipython-input-3-c733016efef5> in <module>()
----> 1 np.searchsorted(a, 1)
/home/charris/.local/lib/python2.7/site-packages/numpy/core/fromnumeric.pyc in searchsorted(a, v, side, sorter)
812 except AttributeError:
813 return _wrapit(a, 'searchsorted', v, side, sorter)
--> 814 return searchsorted(v, side, sorter)
815
816
TypeError: invalid type promotion
In [4]: np.__version__
Out[4]: '1.7.0.dev-d50f961'
I think this is fixed I'm going to close the ticket unless someone can turn up a failure using the current devel version.
Original ticket http://projects.scipy.org/numpy/ticket/2066 on 2012-02-26 by trac user josh.ayers, assigned to unknown.
The following code segfaults. I'm running NumPy 1.6.1 on Windows 7.
The gdb output is below: