[Python-3000] Possible py3k problem.

Martin (gzlist) gzlist at googlemail.com
Wed Nov 19 15:39:43 CET 2008


On 18/11/2008, Lambert, David W (S&T) <LambertDW at corning.com> wrote:
>
>  Attached program works with
>
>         callback = GSL_FUNCTION(self.f)
>         set_with_values(mnzr,callback,xn,fn,xLB,fLB,xUB,fUB)
>
>  But core dumps with
>
>         set_with_values(mnzr,GSL_FUNCTION(self.f),xn,fn,xLB,fLB,xUB,fUB)

This is covered in the documentation, isn't it?

<http://docs.python.org/library/ctypes.html#callback-functions>

Important note for callback functions:

Make sure you keep references to CFUNCTYPE objects as long as they are
used from C code. ctypes doesn't, and if you don't, they may be
garbage collected, crashing your program when a callback is made.

Martin


More information about the Python-3000 mailing list