Segmentation fault with argsort
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 expected result: AttributeError: 'np.int64' object has no attribute 'argsort'
On Fri, Dec 18, 2009 at 11:46, 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 expected result:
AttributeError: 'np.int64' object has no attribute 'argsort'
Why would you expect that? On OS X with an SVN checkout ~1.4: In [1]: np.array(121).argsort(0).argsort(0) Out[1]: 0 In [6]: np.int64.argsort Out[6]: <method 'argsort' of 'numpy.generic' objects> -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
On Fri, Dec 18, 2009 at 12:52 PM, Robert Kern <robert.kern@gmail.com> wrote:
On Fri, Dec 18, 2009 at 11:46, 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 expected result:
AttributeError: 'np.int64' object has no attribute 'argsort'
Why would you expect that? On OS X with an SVN checkout ~1.4:
In [1]: np.array(121).argsort(0).argsort(0) Out[1]: 0
In [6]: np.int64.argsort Out[6]: <method 'argsort' of 'numpy.generic' objects>
Kubuntu 9.10 In [1]: import numpy as np In [2]: np.__version__ Out[2]: '1.4.0.dev7539' In [3]: np.array(121).argsort(0).argsort(0) Segmentation fault -Skipper
On Fri, Dec 18, 2009 at 11:57, Skipper Seabold <jsseabold@gmail.com> wrote:
On Fri, Dec 18, 2009 at 12:52 PM, Robert Kern <robert.kern@gmail.com> wrote:
On Fri, Dec 18, 2009 at 11:46, 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 expected result:
AttributeError: 'np.int64' object has no attribute 'argsort'
Why would you expect that? On OS X with an SVN checkout ~1.4:
In [1]: np.array(121).argsort(0).argsort(0) Out[1]: 0
In [6]: np.int64.argsort Out[6]: <method 'argsort' of 'numpy.generic' objects>
Kubuntu 9.10
In [1]: import numpy as np
In [2]: np.__version__ Out[2]: '1.4.0.dev7539'
In [3]: np.array(121).argsort(0).argsort(0) Segmentation fault
Can you give us a gdb backtrace? -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco
On Fri, Dec 18, 2009 at 1:00 PM, Robert Kern <robert.kern@gmail.com> wrote:
Can you give us a gdb backtrace?
No idea what I'm doing, but I figure I should learn a bit... Does this look right? skipper@linux-desktop:~$ gdb python GNU gdb (GDB) 7.0-ubuntu Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /usr/bin/python...Reading symbols from /usr/lib/debug/usr/bin/python2.6...done. (no debugging symbols found)...done. (gdb) run argsort_seg.py Starting program: /usr/bin/python argsort_seg.py [Thread debugging using libthread_db enabled] Program received signal SIGSEGV, Segmentation fault. 0x00000000004b499a in _PyArg_ParseTupleAndKeywords_SizeT (args=0x7ffff7f54ad0, keywords=0x7ffff6d89eb0, format=0x7ffff6d9308d "|O&O&O", kwlist=0x7ffff6faa5a0) at ../Python/getargs.c:1409 1409 ../Python/getargs.c: No such file or directory. in ../Python/getargs.c (gdb)
On Fri, Dec 18, 2009 at 1:07 PM, Skipper Seabold <jsseabold@gmail.com> wrote:
On Fri, Dec 18, 2009 at 1:00 PM, Robert Kern <robert.kern@gmail.com> wrote:
Can you give us a gdb backtrace?
No idea what I'm doing, but I figure I should learn a bit... Does this look right?
skipper@linux-desktop:~$ gdb python GNU gdb (GDB) 7.0-ubuntu Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /usr/bin/python...Reading symbols from /usr/lib/debug/usr/bin/python2.6...done. (no debugging symbols found)...done. (gdb) run argsort_seg.py Starting program: /usr/bin/python argsort_seg.py [Thread debugging using libthread_db enabled]
Program received signal SIGSEGV, Segmentation fault. 0x00000000004b499a in _PyArg_ParseTupleAndKeywords_SizeT (args=0x7ffff7f54ad0, keywords=0x7ffff6d89eb0, format=0x7ffff6d9308d "|O&O&O", kwlist=0x7ffff6faa5a0) at ../Python/getargs.c:1409 1409 ../Python/getargs.c: No such file or directory. in ../Python/getargs.c (gdb)
And .... (gdb) backtrace #0 0x00000000004b499a in _PyArg_ParseTupleAndKeywords_SizeT (args=0x7ffff7f54ad0, keywords=0x7ffff6d89eb0, format=0x7ffff6d9308d "|O&O&O", kwlist=0x7ffff6faa5a0) at ../Python/getargs.c:1409 #1 0x00007ffff6d7a08a in array_argsort (self=0xaf9af0, args=0x7ffff7f54ad0, kwds=0x7ffff6d89eb0) at numpy/core/src/multiarray/methods.c:1063 #2 0x000000000041d6e7 in PyObject_Call (func=0x7ffff46cd950, arg=0x7ffff6d89eb0, kw=0x7ffff6d9308d) at ../Objects/abstract.c:2492 #3 0x00007ffff6d89952 in gentype_generic_method (self=<value optimized out>, args=0x7ffff7f54ad0, kwds=0x7ffff6d89eb0, str=<value optimized out>) at numpy/core/src/multiarray/scalartypes.c.src:201 #4 0x00000000004a290d in call_function (f=0x90ed90, throwflag=<value optimized out>) at ../Python/ceval.c:3706 #5 PyEval_EvalFrameEx (f=0x90ed90, throwflag=<value optimized out>) at ../Python/ceval.c:2389 #6 0x00000000004a40e0 in PyEval_EvalCodeEx (co=0x7ffff7ef0eb8, globals=<value optimized out>, locals=<value optimized out>, args=0x0, argcount=<value optimized out>, kws=<value optimized out>, kwcount=0, defs=0x0, defcount=0, closure=0x0) at ../Python/ceval.c:2968 #7 0x00000000004a41b2 in PyEval_EvalCode (co=0x7ffff7f54ad0, globals=0x7ffff6d89eb0, locals=0x7ffff6d9308d) at ../Python/ceval.c:522 #8 0x00000000004c33a0 in run_mod (fp=0x90e230, filename=<value optimized out>, start=<value optimized out>, globals=<value optimized out>, locals=0x8b9270, closeit=1, flags=0x7fffffffe130) at ../Python/pythonrun.c:1335 #9 PyRun_FileExFlags (fp=0x90e230, filename=<value optimized out>, start=<value optimized out>, globals=<value optimized out>, locals=0x8b9270, closeit=1, flags=0x7fffffffe130) at ../Python/pythonrun.c:1321 #10 0x00000000004c3564 in PyRun_SimpleFileExFlags (fp=<value optimized out>, filename=0x7fffffffe542 "argsort_seg.py", closeit=1, flags=0x7fffffffe130) at ../Python/pythonrun.c:931 #11 0x0000000000418ab7 in Py_Main (argc=-135384960, argv=<value optimized out>) at ../Modules/main.c:599 ---Type <return> to continue, or q <return> to quit--- #12 0x00007ffff6fd0abd in __libc_start_main (main=<value optimized out>, argc=<value optimized out>, ubp_av=<value optimized out>, init=<value optimized out>, fini=<value optimized out>, rtld_fini=<value optimized out>, stack_end=0x7fffffffe248) at libc-start.c:220 #13 0x0000000000417ca9 in _start () at ../sysdeps/x86_64/elf/start.S:113
On Fri, Dec 18, 2009 at 10:57 AM, Skipper Seabold <jsseabold@gmail.com>wrote:
On Fri, Dec 18, 2009 at 12:52 PM, Robert Kern <robert.kern@gmail.com> wrote:
On Fri, Dec 18, 2009 at 11:46, 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 expected result:
AttributeError: 'np.int64' object has no attribute 'argsort'
Why would you expect that? On OS X with an SVN checkout ~1.4:
In [1]: np.array(121).argsort(0).argsort(0) Out[1]: 0
In [6]: np.int64.argsort Out[6]: <method 'argsort' of 'numpy.generic' objects>
Kubuntu 9.10
In [1]: import numpy as np
In [2]: np.__version__ Out[2]: '1.4.0.dev7539'
In [3]: np.array(121).argsort(0).argsort(0) Segmentation fault
I also see that here on ubuntu 9.10, 64 bits. ISTR recall another such issue on ubuntu, which makes me think that there might be a compiler problem. Chuck
On Fri, Dec 18, 2009 at 1:01 PM, Charles R Harris <charlesr.harris@gmail.com> wrote:
On Fri, Dec 18, 2009 at 10:57 AM, Skipper Seabold <jsseabold@gmail.com> wrote:
On Fri, Dec 18, 2009 at 12:52 PM, Robert Kern <robert.kern@gmail.com> wrote:
On Fri, Dec 18, 2009 at 11:46, 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 expected result:
AttributeError: 'np.int64' object has no attribute 'argsort'
Why would you expect that? On OS X with an SVN checkout ~1.4:
In [1]: np.array(121).argsort(0).argsort(0) Out[1]: 0
In [6]: np.int64.argsort Out[6]: <method 'argsort' of 'numpy.generic' objects>
Kubuntu 9.10
In [1]: import numpy as np
In [2]: np.__version__ Out[2]: '1.4.0.dev7539'
In [3]: np.array(121).argsort(0).argsort(0) Segmentation fault
Segmentation fault same here WindowsXP 32, numpy 1.4.0rc1, python 2.5.2 Josef
I also see that here on ubuntu 9.10, 64 bits. ISTR recall another such issue on ubuntu, which makes me think that there might be a compiler problem.
Chuck
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
On Fri, Dec 18, 2009 at 9:52 AM, Robert Kern <robert.kern@gmail.com> wrote:
On Fri, Dec 18, 2009 at 11:46, 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 expected result:
AttributeError: 'np.int64' object has no attribute 'argsort'
Why would you expect that? On OS X with an SVN checkout ~1.4:
In [1]: np.array(121).argsort(0).argsort(0) Out[1]: 0
In [6]: np.int64.argsort Out[6]: <method 'argsort' of 'numpy.generic' objects>
Oh, I didn't realize numpy scalars had all of the methods of arrays.
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 expected result:
AttributeError: 'np.int64' object has no attribute 'argsort' ___
On an old install of fedora 11 with '1.4.0.dev' I get In [2]: array(121).argsort(0).argsort(0) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/charris/<ipython console> in <module>() TypeError: function takes at most 3 arguments (175832141 given) In [3]: np.array(121).argsort(0).argsort(0) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/charris/<ipython console> in <module>() TypeError: function takes at most 3 arguments (175832045 given) Which looks suspicious ;) Now to update that numpy install... and I get the same error. This is python 2.6, but I don't know what minor version it is. Chuck
On 12/18/2009 9:46 AM, Keith Goodman 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 expected result:
AttributeError: 'np.int64' object has no attribute 'argsort'
On Windows 7 with Python 2.6.4 and numpy 1.4 built with vc2008 from svn source: the 64-bit version works, the 32-bit version throws a SystemError: C:\>python26-x64 Python 2.6.4 (r264:75708, Oct 26 2009, 07:36:50) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
import numpy numpy.__version__ '1.4.0rc2.dev8016' numpy.array(121).argsort(0).argsort(0) 0
C:\>python26 Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
import numpy numpy.__version__ '1.4.0rc2.dev8016' numpy.array(121).argsort(0).argsort(0) Traceback (most recent call last): File "<stdin>", line 1, in <module> SystemError: ..\Python\getargs.c:1413: bad argument to internal function
-- Christoph
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
On Fri, Dec 18, 2009 at 1:02 PM, Charles R Harris <charlesr.harris@gmail.com> wrote:
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},
Not sure I should have, but I created a ticket: http://projects.scipy.org/numpy/ticket/1339
On Fri, Dec 18, 2009 at 2:02 PM, Charles R Harris <charlesr.harris@gmail.com
wrote:
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},
Changing the generated function gentype_argsort to pass NULL for the keyword argument also fixes the problem. This may be the correct fix, but in terms of avoiding special cases it may be better to have it take the normal run of keywords. Note that view doesn't take keywords so a dtype can't be passed, making it kind of useless. I think the whole method section for types could use an audit. Chuck
participants (6)
-
Charles R Harris -
Christoph Gohlke -
josef.pktd@gmail.com -
Keith Goodman -
Robert Kern -
Skipper Seabold