[Numpy-discussion] embedded arrays- still an issue

Thomas Hrabe thrabe@burnham....
Tue Jun 24 13:59:40 CDT 2008


Hi all, 


I finally managed to come back to my memory troubles which I have described recently to this group (see below). Here is the requested backtrace of my program:

#0  0x94659b88 in strlen ()
#1  0x004437b8 in PyString_FromFormatV (format=0x4f2360 "'%.50s' object has no attribute '%.400s'", vargs=0xbfffee00 "") at /Users/ronald/r252/Objects/stringobject.c:202
#2  0x004a57e8 in PyErr_Format (exception=0x505fb4, format=0xbfffee00 "") at /Users/ronald/r252/Python/errors.c:522
#3  0x00432430 in PyObject_GetAttr (v=0x80ef40, name=0xc5278) at /Users/ronald/r252/Objects/object.c:1130
#4  0x004324b8 in PyObject_GetAttrString (v=0x80ef40, name=0x0) at /Users/ronald/r252/Objects/object.c:1069
#5  0x00b47660 in PyArray_FromStructInterface ()
#6  0x00b47938 in PyArray_FromAny ()
#7  0x00b72fb4 in array_richcompare ()
#8  0x004341f0 in PyObject_RichCompare (v=0x80ef40, w=0x8b9440, op=2) at /Users/ronald/r252/Objects/object.c:874
#9  0x00490d20 in PyEval_EvalFrameEx (f=0x8b9090, throwflag=9146828) at /Users/ronald/r252/Python/ceval.c:3989
#10 0x00493e50 in PyEval_EvalCodeEx (co=0xf4d578, globals=0xbfffee00, locals=0x4437b8, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at /Users/ronald/r252/Python/ceval.c:2836
#11 0x00493ff0 in PyEval_EvalCode (co=0x0, globals=0xbfffee00, locals=0x0) at /Users/ronald/r252/Python/ceval.c:494
#12 0x004b9b24 in PyRun_InteractiveOneFlags (fp=0x0, filename=0x4f88f0 "<stdin>", flags=0xbffff448) at /Users/ronald/r252/Python/pythonrun.c:1273
#13 0x004b9d30 in PyRun_InteractiveLoopFlags (fp=0xa08bf374, filename=0x4f88f0 "<stdin>", flags=0xbffff448) at /Users/ronald/r252/Python/pythonrun.c:723
#14 0x004ba3f0 in PyRun_AnyFileExFlags (fp=0xa08bf374, filename=0x4f88f0 "<stdin>", closeit=0, flags=0xbffff448) at /Users/ronald/r252/Python/pythonrun.c:692
#15 0x004c9a9c in Py_Main (argc=1, argv=0xbffff5d8) at /Users/ronald/r252/Modules/main.c:523
#16 0x000019bc in ?? ()
#17 0x000016c0 in ?? ()
(gdb) 
in /Users/ronald/r252/Objects/stringobject.c

Please let me know if there are any ways how to go on from this point. I am new into this kind of debugging...

Thank you in advance for your help,
Thomas

-----Ursprüngliche Nachricht-----
Von: numpy-discussion-bounces@scipy.org im Auftrag von Robert Kern
Gesendet: Fr 06.06.2008 15:27
An: Discussion of Numerical Python
Betreff: Re: [Numpy-discussion] embedded arrays
 
On Fri, Jun 6, 2008 at 17:10, Thomas Hrabe <thrabe@burnham.org> wrote:
> Hi all,
>
> while writing a extension module in C++ for python & numpy, I find a strange
> error.
>
> I can send and retrieve numpy arrays to and from my module.
> But python stops if I do the following:
>
> a = numpy.array([[1.1,2,3],[4,5,6]])
> PM.put(a,'a')   //send a to the module
> b = PM.get('a') //get a identical copy from the module
> print b
> array([[ 1.1,  2. ,  3. ],
>        [ 4. ,  5. ,  6. ]])
>
> b.__class__
> Out[36]: <type 'numpy.ndarray'>
>
>
> perfect, until
> a == b
>
> the interpreter does not continue from here...
> I can add values to to b, everything, but a == b simply crashes ...?
>
> Does anybody have a clue for this problem?

Not really. It probably depends on some details with your interfacing.
Since we don't have access to your code, we don't have much to go on.
You might have buggy reference counting or perhaps you gave the numpy
ndarray ownership of the array's memory when it actually shouldn't.
Memory issues can be a bit finicky where everything will work for a
while, then crash.

Try running your program under a C debugger like gdb so we can get a
backtrace. That might give us some more ideas about exactly where
problems are occurring.




-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 4731 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080624/9497ce5d/attachment.bin 


More information about the Numpy-discussion mailing list