[Numpy-tickets] [NumPy] #1022: numpy segfaults when ufunc is called with ndarray subclass and out=None
NumPy
numpy-tickets@scipy....
Sun Feb 22 17:30:47 CST 2009
#1022: numpy segfaults when ufunc is called with ndarray subclass and out=None
------------------------+---------------------------------------------------
Reporter: DarrenDale | Owner: somebody
Type: defect | Status: new
Priority: high | Milestone: 1.3.0
Component: numpy.core | Version: none
Severity: major | Keywords:
------------------------+---------------------------------------------------
I am seeing some really strange behavior when I try to pass an ndarray
subclass and out=None to numpy's ufuncs. This example will reproduce the
problem with svn numpy, the first print statement yields 1 as expected,
the second yields "<type 'builtin_function_or_method'>" and the third
yields a segmentation fault. I'm running this as a script, not with
ipython:
{{{
import numpy as np
class MyArray(np.ndarray):
__array_priority__ = 20
def __new__(cls):
return np.asarray(1).view(cls).copy()
def __repr__(self):
return 'my_array'
__str__ = __repr__
def __mul__(self, other):
return super(MyArray, self).__mul__(other)
def __rmul__(self, other):
return super(MyArray, self).__rmul__(other)
mine = MyArray()
print np.multiply(1, 1, None)
x = np.multiply(mine, mine, None)
print type(x)
print x
}}}
--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/1022>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
More information about the Numpy-tickets
mailing list