[AstroPy] Re : strange error with ctypes

Erik Bray embray@stsci....
Thu Feb 16 14:34:57 CST 2012


On 02/16/2012 02:47 PM, Jerome Caron wrote:
> Dear James,
>>I believe it could cause an error if either the pointer Line has been
>>changed, so you are trying to free the wrong memory, or something has
>>inadvertently overwritten the memory you're trying to free
> Thanks for the suggestion ! You're right, this could be a possibility. I
> checked carefully the code, but the only instructions with Line are
> assignments and arithmetic operations with Line[i], i varying from 0 to
> Width-1. There is not a single operation with the pointer itself. So I
> don't see what could be wrong...
> This piece of code in my dll is a third party library
> (http://bigwww.epfl.ch/thevenaz/interpolation/). The code is nicely
> written, and it's clear than the author knows what he's doing.
> I am a bit puzzled, I am sure if there was such error there would be an
> exception thrown by the dll. But there's no exception: Python reports an
> error in the dll, and the dll does not see any error. It looks like
> Python and C++ do not understand each other. Might this be something
> wrong with my Python code, a bad usage of ctypes ??
> Jerome

Forgive my asking, since I know this wasn't really your question. But is 
there some reason not to use SciPy's interpolation?

Erik


More information about the AstroPy mailing list