[Numpy-discussion] segmentation fault

Charles R Harris charlesr.harris at gmail.com
Wed May 28 15:34:07 EDT 2008


On Wed, May 28, 2008 at 1:17 PM, Alan McIntyre <alan.mcintyre at gmail.com>
wrote:

> On Wed, May 28, 2008 at 1:37 PM, Charles R Harris
> <charlesr.harris at gmail.com> wrote:
> > I think the bug is not raising an error on shape mismatch, the assumption
> on
> > the first index follows from that. For the out=x parameter, I propose the
> > rules:
> >
> > 1) x must have the shape of the expected output (1D in this case)
> > 2) x must have the same type as the expected output (currently cast)
>
> That seems to be consistent with the documented behavior of other
> functions that have an 'out' parameter.
>
> I wonder if this is something that ought to be looked at for all
> functions with an "out" parameter?  ndarray.compress also had problems
> with array type mismatch (#789); I can't imagine that it's safe to
> assume only these two functions were doing it incorrectly. (Unless of
> course somebody has recently looked at all of them)
>

I think that is an excellent idea! A good start would be to list all the
functions with the out parameter and then write some tests. The current
behavior is inconsistent and we not only need to specify the behavior, but
fix all the places that don't follow the rules.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080528/2907a967/attachment.html>


More information about the NumPy-Discussion mailing list