Hi,

On Mon, Mar 5, 2012 at 11:11 AM, Matthew Brett <matthew.br...@gmail.com> wrote:
> Hi,
>
> On Sun, Mar 4, 2012 at 11:53 PM, Mark Wiebe <mwwi...@gmail.com> wrote:
>> On Sun, Mar 4, 2012 at 10:34 PM, Matthew Brett <matthew.br...@gmail.com>
>> wrote:
>>>
>>> <snip>
>>> > $ export NPY_SEPARATE_COMPILATION=1
>>>
>>> Thanks, that did it:
>>>
>>> 9194b3af704df71aa9b1ff2f53f169848d0f9dc7 is the first bad commit
>>>
>>> Let me know if I can debug further,
>>
>>
>> That commit was a rewrite of np.concatenate, and I've traced the test
>> function you got the crash in. The only call to concatenate is as follows:
>>
>>>>> a = np.array([True], dtype=object)
>>>>> np.concatenate((a,)*3)
>> array([True, True, True], dtype=object)
>>>>>
>>
>> Can you try this and see if it crashes?
>
> No, that doesn't crash.
>
> Further investigation revealed the crash to be:
>
> (bare-env)[matthew@vagus ~]$ nosetests
> ~/dev_trees/numpy/numpy/lib/tests/test_io.py:TestFromTxt.test_with_masked_column_various
> nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
> Test masked column ... Bus error
>
> Accordingly:
>
> In [1]: import numpy as np
>
> In [2]: from StringIO import StringIO
>
> In [3]: data = StringIO('True 2 3\nFalse 5 6\n')
>
> In [4]: test = np.genfromtxt(data, dtype=None, missing_values='2,5',
> usemask=True)
>
> In [6]: from numpy import ma
>
> In [7]: control = ma.array([(1, 2, 3), (0, 5, 6)], mask=[(0, 1, 0),
> (0, 1, 0)], dtype=[('f0', bool), ('f1', bool), ('f2', int)])
>
> In [8]: test == control
> Bus error
>
>> Another thing you can do is compile with debug information enabled, then run
>> the crashing case in gdb. This will look something like this:
>>
>> $ export CFLAGS=-g
>> $ rm -rf build # make sure it's a fresh build from scratch
>> $ python setup.py install --prefix=<dir> # or however you do it
>> [... build printout]
>> $ gdb python <script/options>
>> [... gdb info]
>> (gdb) run
>>  [... script runs]
>> Program received signal SIGSEGV, Segmentation fault,
>> [crash address]
>> (gdb) backtrace
>> [full backtrace printout]
>>
>> Such a backtrace would be immensely helpful in tracking down why it's
>> crashing.
>
> I'll get back to you with this.

<atest.py>
from StringIO import StringIO

import numpy as np
from numpy import ma

data = StringIO('True 2 3\nFalse 5 6\n')
test = np.genfromtxt(data, dtype=None, missing_values='2,5',
                     usemask=True)
control = ma.array([(1, 2, 3), (0, 5, 6)], mask=[(0, 1, 0), (0, 1, 0)],
                   dtype=[('f0', bool), ('f1', bool), ('f2', int)])
test == control
</atest.py

gdb python
run atest.py

backtrace full attached.

See you,

Matthew
#0  0xf79b75a4 in _aligned_strided_to_strided_size4_srcstride0 (dst=0xffffacc8 "\377\377\255h", dst_stride=0, src=0x8d3dca "", __NPY_UNUSED_TAGGEDsrc_stride=0, 
    N=1, __NPY_UNUSED_TAGGEDsrc_itemsize=4, __NPY_UNUSED_TAGGEDdata=0x0) at numpy/core/src/multiarray/lowlevel_strided_loops.c.src:196
        temp = 7
#1  0xf7956380 in PyArray_CastRawArrays (count=1, src=0x8d3dca "", dst=0xffffacc8 "\377\377\255h", src_stride=0, dst_stride=0, src_dtype=0xf7adacd4, 
    dst_dtype=0xf7adacd4, move_references=0) at numpy/core/src/multiarray/dtype_transfer.c:3865
        stransfer = 0xf79b7584 <_aligned_strided_to_strided_size4_srcstride0>
        transferdata = 0x0
        aligned = 1
        needs_api = 0
#2  0xf78f8fd4 in PyArray_AssignRawScalar (dst=0x883ed8, src_dtype=0xf7adacd4, src_data=0x8d3dca "", wheremask=0x883e88, casting=NPY_SAME_KIND_CASTING, 
    preservena=0 '\000', preservewhichna=0x0) at numpy/core/src/multiarray/array_assign_scalar.c:390
        tmp_src_data = 0xffffacc8 "\377\377\255h"
        allocated_src_data = 0
        dst_has_maskna = 0
        scalarbuffer = {-90812779577720, -599647614278287736, 1099511627776, 0}
#3  0xf78faae4 in PyArray_AssignArray (dst=0x883ed8, src=0x883f28, wheremask=0x883e88, casting=NPY_SAME_KIND_CASTING, preservena=0 '\000', preservewhichna=0x0)
    at numpy/core/src/multiarray/array_assign_array.c:410
        dst_has_maskna = 0
        src_has_maskna = 0
        copied_src = 0
        src_strides = {0, -139730776, 2, 0, 0, 0, -139722760, 2, 4, 5, 2, 0, 0, -139555256, 1, 9481980, 9481896, 7168208, 473795708, 2128, 7, 9333623, -139632288, 
          4526776, 9481896, -139726632, -139600928, -139616340, -20568, -20704, -140352480, -20652}
        src_maskna_strides = {0, 1280, -139614652, -139616340, 2, -20652, 3752016, 0, 3752016, 0, 1, 1, 9256394, 2, 0, 5083832, 8928904, 5083832, 8929144, 
          -139616340, 12, 12, 0, 0, 8928904, -139614652, 32768, -20720, -20724, -20856, -20728, -20716}
#4  0xf7a264dc in array_copyto (__NPY_UNUSED_TAGGEDignored=0x0, args=0x4512b8, kwds=0x90aea8) at numpy/core/src/multiarray/multiarraymodule.c:1911
        kwlist = {0xf7abffe8 "dst", 0xf7abfff0 "src", 0xf7abf4c8 "casting", 0xf7abf900 "where", 0xf7abfff8 "preservena", 0x0}
        wheremask_in = 0x883e88
        dst = 0x883ed8
        src = 0x883f28
        wheremask = 0x883e88
        casting = NPY_SAME_KIND_CASTING
        preservena = 0
#5  0x0023e374 in PyCFunction_Call (func=0x4d0df8, arg=0x4512b8, kw=0x90aea8) at ../Objects/methodobject.c:85
        f = 0x4d0df8
        meth = 0xf7a26364 <array_copyto>
        self = 0x0
        size = 8928984
#6  0x00122dbc in do_call (func=0x4d0df8, pp_stack=0xffffb224, na=2, nk=1) at ../Python/ceval.c:3965
        tstate = 0x394050
        callargs = 0x4512b8
        kwdict = 0x90aea8
        result = 0x0
#7  0x00121da0 in call_function (pp_stack=0xffffb224, oparg=258) at ../Python/ceval.c:3773
        na = 2
        nk = 1
        n = 4
        pfunc = 0x8d427c
        func = 0x4d0df8
        x = 0x883e38
        w = 0x3cf060
#8  0x0011afe8 in PyEval_EvalFrameEx (f=0x8d4120, throwflag=0) at ../Python/ceval.c:2412
        sp = 0x8d4280
        stack_pointer = 0x8d4290
        next_instr = 0x863155 "\001q\023"
        opcode = 131
        oparg = 258
        why = WHY_NOT
        err = 0
        x = 0x883e88
        v = 0x83
        w = 0x3cf060
        u = 0x0
        t = 0x102
        stream = 0x0
        fastlocals = 0x8d4260
        freevars = 0x8d4278
        retval = 0x0
        tstate = 0x394050
        co = 0x865448
        instr_ub = -1
        instr_lb = 0
        instr_prev = -1
        first_instr = 0x8630ec "|"
        names = 0x8660c8
        consts = 0x859db8
        filename = 0x864744 "/home/matthew/.virtualenvs/bare-dbg/lib/python2.6/site-packages/numpy/ma/core.py"
        __PRETTY_FUNCTION__ = "PyEval_EvalFrameEx"
#9  0x00122158 in fast_function (func=0x8ff458, pp_stack=0xffffb4d4, n=3, na=3, nk=0) at ../Python/ceval.c:3836
        retval = 0x0
        fastlocals = 0x8d4260
        i = 3
        f = 0x8d4120
        tstate = 0x394050
        stack = 0x8d3bdc
        co = 0x865448
        globals = 0x84de00
        argdefs = 0x0
        d = 0x0
        nd = 0
        __PRETTY_FUNCTION__ = "fast_function"
#10 0x00121d78 in call_function (pp_stack=0xffffb4d4, oparg=3) at ../Python/ceval.c:3771
        na = 3
        nk = 0
        n = 3
        pfunc = 0x8d3bcc
        func = 0x8ff458
        x = 0x861458
        w = 0x6d60d0
#11 0x0011afe8 in PyEval_EvalFrameEx (f=0x8d3a78, throwflag=0) at ../Python/ceval.c:2412
        sp = 0x8d3bdc
        stack_pointer = 0x8d3bdc
        next_instr = 0x8e6b77 "\001n\346"
        opcode = 131
        oparg = 3
        why = WHY_NOT
        err = 0
        x = 0x883d48
        v = 0x83
        w = 0x6d60d0
        u = 0x850
        t = 0x3
        stream = 0x0
        fastlocals = 0x8d3bb8
        freevars = 0x8d3bcc
        retval = 0x0
        tstate = 0x394050
        co = 0x86e868
        instr_ub = -1
        instr_lb = 0
        instr_prev = -1
        first_instr = 0x8e6ae4 "|"
        names = 0x7a9d48
        consts = 0x8667d0
        filename = 0x86adc4 "/home/matthew/.virtualenvs/bare-dbg/lib/python2.6/site-packages/numpy/ma/core.py"
        __PRETTY_FUNCTION__ = "PyEval_EvalFrameEx"
#12 0x0011e48c in PyEval_EvalCodeEx (co=0x86e868, globals=0x84de00, locals=0x0, args=0x8d3a40, argcount=2, kws=0x8d3a48, kwcount=0, defs=0x8f9cc4, defcount=1, 
    closure=0x0) at ../Python/ceval.c:3000
        f = 0x8d3a78
        retval = 0x0
        fastlocals = 0x8d3bb8
        freevars = 0x8d3bcc
        tstate = 0x394050
        x = 0x39ffc8
        u = 0x9121a0
        __PRETTY_FUNCTION__ = "PyEval_EvalCodeEx"
#13 0x001222b4 in fast_function (func=0x902198, pp_stack=0xffffb86c, n=2, na=2, nk=0) at ../Python/ceval.c:3846
        co = 0x86e868
        globals = 0x84de00
        argdefs = 0x8f9cb0
        d = 0x8f9cc4
        nd = 1
        __PRETTY_FUNCTION__ = "fast_function"
#14 0x00121d78 in call_function (pp_stack=0xffffb86c, oparg=1) at ../Python/ceval.c:3771
        na = 2
        nk = 0
        n = 2
        pfunc = 0x8d3a40
        func = 0x902198
        x = 0x861458
        w = 0x7c07d0
#15 0x0011afe8 in PyEval_EvalFrameEx (f=0x8d38f8, throwflag=0) at ../Python/ceval.c:2412
        sp = 0x8d3a48
        stack_pointer = 0x8d3a48
        next_instr = 0x7a9818 "S\001t\002"
        opcode = 131
        oparg = 1
        why = WHY_NOT
        err = 0
        x = 0x39ffc8
        v = 0x83
        w = 0x7c07d0
        u = 0x0
        t = 0x1
        stream = 0x0
        fastlocals = 0x8d3a38
        freevars = 0x8d3a40
        retval = 0x0
        tstate = 0x394050
        co = 0x7bba48
        instr_ub = -1
        instr_lb = 0
        instr_prev = -1
        first_instr = 0x7a97fc "t"
        names = 0x7bcb28
        consts = 0x7be8f0
        filename = 0x85b344 "/home/matthew/.virtualenvs/bare-dbg/lib/python2.6/site-packages/numpy/ma/core.py"
        __PRETTY_FUNCTION__ = "PyEval_EvalFrameEx"
#16 0x0011e48c in PyEval_EvalCodeEx (co=0x7bba48, globals=0x84de00, locals=0x0, args=0x8d38b0, argcount=2, kws=0x8d38b8, kwcount=0, defs=0x8f904c, defcount=1, 
    closure=0x0) at ../Python/ceval.c:3000
        f = 0x8d38f8
        retval = 0x0
        fastlocals = 0x8d3a38
        freevars = 0x8d3a40
        tstate = 0x394050
        x = 0x39ffc8
        u = 0x9121a0
        __PRETTY_FUNCTION__ = "PyEval_EvalCodeEx"
#17 0x001222b4 in fast_function (func=0x8fa140, pp_stack=0xffffbc04, n=2, na=2, nk=0) at ../Python/ceval.c:3846
        co = 0x7bba48
        globals = 0x84de00
        argdefs = 0x8f9038
        d = 0x8f904c
        nd = 1
        __PRETTY_FUNCTION__ = "fast_function"
#18 0x00121d78 in call_function (pp_stack=0xffffbc04, oparg=2) at ../Python/ceval.c:3771
        na = 2
        nk = 0
        n = 2
        pfunc = 0x8d38ac
        func = 0x8fa140
        x = 0x883e38
        w = 0x0
#19 0x0011afe8 in PyEval_EvalFrameEx (f=0x8d3740, throwflag=0) at ../Python/ceval.c:2412
        sp = 0x8d38b8
        stack_pointer = 0x8d38b8
        next_instr = 0x8e7c3c "}\004"
        opcode = 131
        oparg = 2
        why = WHY_NOT
        err = 0
        x = 0x39ffc8
        v = 0x83
        w = 0x7c07d0
        u = 0x4dfc27b8
        t = 0x2
        stream = 0x0
        fastlocals = 0x8d3880
        freevars = 0x8d38ac
        retval = 0x0
        tstate = 0x394050
        co = 0x86eb68
        instr_ub = -1
        instr_lb = 0
        instr_prev = -1
        first_instr = 0x8e7ba4 "|"
        names = 0x855610
        consts = 0x85dcb8
        filename = 0x86b144 "/home/matthew/.virtualenvs/bare-dbg/lib/python2.6/site-packages/numpy/ma/core.py"
        __PRETTY_FUNCTION__ = "PyEval_EvalFrameEx"
#20 0x0011e48c in PyEval_EvalCodeEx (co=0x86eb68, globals=0x84de00, locals=0x0, args=0x76bc0c, argcount=2, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0)
    at ../Python/ceval.c:3000
        f = 0x8d3740
        retval = 0x0
        fastlocals = 0x8d3880
        freevars = 0x8d38ac
        tstate = 0x394050
        x = 0x861458
        u = 0x90aea8
        __PRETTY_FUNCTION__ = "PyEval_EvalCodeEx"
#21 0x0023d59c in function_call (func=0x902350, arg=0x76bbf8, kw=0x0) at ../Objects/funcobject.c:524
        result = 0x907213
        argdefs = 0x0
        d = 0x0
        k = 0x0
        nk = 0
        nd = 0
#22 0x00035994 in PyObject_Call (func=0x902350, arg=0x76bbf8, kw=0x0) at ../Objects/abstract.c:2492
        result = 0x76bbe8
        call = 0x23d36c <function_call>
#23 0x00044054 in instancemethod_call (func=0x902350, arg=0x76bbf8, kw=0x0) at ../Objects/classobject.c:2579
        self = 0x7a6c38
        klass = 0x8b63e8
        result = 0x900ef8
#24 0x00035994 in PyObject_Call (func=0x75d6b8, arg=0x44c1f8, kw=0x0) at ../Objects/abstract.c:2492
        result = 0x44c20c
        call = 0x43d44 <instancemethod_call>
#25 0x000d1a88 in half_richcompare (self=0x7a6c38, other=0x861458, op=2) at ../Objects/typeobject.c:5513
        func = 0x75d6b8
        args = 0x44c1f8
        res = 0x17
        op_str = {0x0, 0x0, 0xf7ae3990, 0x0, 0x0, 0x0}
#26 0x000d1bf4 in slot_tp_richcompare (self=0x7a6c38, other=0x861458, op=2) at ../Objects/typeobject.c:5526
        res = 0x8812c8
#27 0x00087944 in PyObject_RichCompare (v=0x7a6c38, w=0x861458, op=2) at ../Objects/object.c:958
        fcmp = 0
        frich = 0xd1bb0 <slot_tp_richcompare>
        res = 0xa
        __PRETTY_FUNCTION__ = "PyObject_RichCompare"
#28 0x00124424 in cmp_outcome (op=2, v=0x7a6c38, w=0x861458) at ../Python/ceval.c:4255
        res = 0
#29 0x00119ce0 in PyEval_EvalFrameEx (f=0x47b5d8, throwflag=0) at ../Python/ceval.c:2113
        stack_pointer = 0x47b71c
        next_instr = 0xf7b1f628 "\001d\002"
        opcode = 8023096
        oparg = 2
        why = WHY_NOT
        err = 0
        x = 0x861458
        v = 0x7a6c38
        w = 0x861458
        u = 0x39ffdc
        t = 0x2
        stream = 0x0
        fastlocals = 0x47b718
        freevars = 0x47b718
        retval = 0x0
        tstate = 0x394050
        co = 0xf7b15e08
        instr_ub = -1
        instr_lb = 0
        instr_prev = -1
        first_instr = 0xf7b1f584 "d"
        names = 0x3d70a0
        consts = 0x42c9c8
        filename = 0x4477b4 "atest.py"
        __PRETTY_FUNCTION__ = "PyEval_EvalFrameEx"
#30 0x0011e48c in PyEval_EvalCodeEx (co=0xf7b15e08, globals=0xf7b20ea8, locals=0xf7b20ea8, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, 
    closure=0x0) at ../Python/ceval.c:3000
        f = 0x47b5d8
        retval = 0x0
        fastlocals = 0x47b718
        freevars = 0x47b718
        tstate = 0x394050
        x = 0x0
        u = 0x0
        __PRETTY_FUNCTION__ = "PyEval_EvalCodeEx"
#31 0x00111e74 in PyEval_EvalCode (co=0xf7b15e08, globals=0xf7b20ea8, locals=0xf7b20ea8) at ../Python/ceval.c:541
No locals.
#32 0x0015fa90 in run_mod (mod=0x481fe8, filename=0xffffcb80 "atest.py", globals=0xf7b20ea8, locals=0xf7b20ea8, flags=0xffffc888, arena=0x3a28e0)
    at ../Python/pythonrun.c:1351
        co = 0xf7b15e08
        v = 0xf7b17410
#33 0x0015fa00 in PyRun_FileExFlags (fp=0x4217a8, filename=0xffffcb80 "atest.py", start=257, globals=0xf7b20ea8, locals=0xf7b20ea8, closeit=1, flags=0xffffc888)
    at ../Python/pythonrun.c:1337
        ret = 0x0
        mod = 0x481fe8
        arena = 0x3a28e0
#34 0x0015d9e8 in PyRun_SimpleFileExFlags (fp=0x4217a8, filename=0xffffcb80 "atest.py", closeit=1, flags=0xffffc888) at ../Python/pythonrun.c:941
        m = 0x3afa80
        d = 0xf7b20ea8
        v = 0x43ed38
        ext = 0xffffcb84 "t.py"
        set_file_name = 1
        ret = 3752016
        len = 8
#35 0x0015ccf4 in PyRun_AnyFileExFlags (fp=0x4217a8, filename=0xffffcb80 "atest.py", closeit=1, flags=0xffffc888) at ../Python/pythonrun.c:745
No locals.
#36 0x00026a44 in Py_Main (argc=2, argv=0xffffca04) at ../Modules/main.c:577
        c = -1
        sts = -1
        command = 0x0
        filename = 0xffffcb80 "atest.py"
        module = 0x0
        fp = 0x4217a8
        p = 0x0
        unbuffered = 0
        skipfirstline = 0
        stdin_is_interactive = 1
        help = 0
        version = 0
        saw_unbuffered_flag = 0
        cf = {cf_flags = 0}
#37 0x00024e1c in main (argc=2, argv=0xffffca04) at ../Modules/python.c:23
No locals.
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to