[Numpy-discussion] Segmentation fault with argsort

Charles R Harris charlesr.harris@gmail....
Fri Dec 18 15:02:39 CST 2009


On Fri, Dec 18, 2009 at 10:46 AM, Keith Goodman <kwgoodman@gmail.com> wrote:

> I am using the numpy 1.3 binary from Ubuntu 9.10. Is this already
> known, fixed, reproducible?
>
> >> np.array(121).argsort(0).argsort(0)
> Segmentation fault
>
>
The immediate problem is in scalartypes.c.src in these lines

    {"sort",
        (PyCFunction)gentype_sort,
        METH_VARARGS, NULL},
    {"argsort",
        (PyCFunction)gentype_argsort,
        METH_VARARGS, NULL},

But the methods array_{argsort, sort} take keywords and are called that way.
The following version fixes things, but I am not sure it is the correct fix,
the gentype_* functions may need to be fixed instead.

    {"sort",
        (PyCFunction)gentype_sort,
        METH_VARARGS|METH_KEYWORDS, NULL},
    {"argsort",
        (PyCFunction)gentype_argsort,
        METH_VARARGS|METH_KEYWORDS, NULL},

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20091218/fed5875e/attachment.html 


More information about the NumPy-Discussion mailing list