[Numpy-discussion] Segmentation fault with argsort

Keith Goodman kwgoodman at gmail.com
Fri Dec 18 16:13:48 EST 2009


On Fri, Dec 18, 2009 at 1:02 PM, Charles R Harris
<charlesr.harris at gmail.com> wrote:
>
>
> On Fri, Dec 18, 2009 at 10:46 AM, Keith Goodman <kwgoodman at 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},

Not sure I should have, but I created a ticket:

http://projects.scipy.org/numpy/ticket/1339



More information about the NumPy-Discussion mailing list