[Numpy-discussion] embedded arrays
Fri Jun 6 17:27:22 CDT 2008
On Fri, Jun 6, 2008 at 17:10, Thomas Hrabe <firstname.lastname@example.org> wrote:
> Hi all,
> while writing a extension module in C++ for python & numpy, I find a strange
> 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. ]])
> Out: <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.
"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
More information about the Numpy-discussion