numarray bug or my?
Marco Bubke
marco at bubke.de
Tue Feb 24 11:48:50 EST 2004
Simon Burton wrote:
> On Mon, 23 Feb 2004 23:14:03 +0100, Marco Bubke wrote:
>
> ...
>> Ok, its in Pyrex and has a bug in
>> flat_view = array_to_int(viewport),
>> but I don't know why. If I change the code to flat_view =
>> array_to_double(viewport) its runnig without glitches. I really dont
>> understand it.
>>
>> Thx
>>
>> Marco
>
> Yes, me too. I wasn't sure if NA_InputArray was supposed
> to be able to handle type conversions, so I used the python
> method:
>
> array = array.astype(numarray.Int32)
>
> and then used NA_InputArray on that.
>
> Simon.
Ok, Than I do that, I get everytime a Segmentation fault. Before it was only
from time to time. An its 100% NA_InputArray. If I erease NA_updateDataPtr
before NA_InputArray I get a amok process.
cdef NumArray array_to_float(NumArray array):
# maybe here is memoty leak!
cdef NumArray flat_array
cdef NumArray new_array
print 'mark 1'
new_array = array.astype('Float32')
print new_array
print 'mark 2'
NA_updateDataPtr(new_array)
print 'mark 3'
NA_IoArray(new_array, tFloat32, NUM_C_ARRAY)
print 'mark 4'
flat_array = NA_updateDataPtr(flat_array)
print 'mark 5'
return flat_array
More information about the Python-list
mailing list