[AstroPy] Re : strange error with ctypes

Jerome Caron jerome_caron_astro at ymail.com
Thu Feb 16 14:47:49 EST 2012


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20120216/31e49fa3/attachment.html>


More information about the AstroPy mailing list