[GRASS-dev] Howto use a Python function as error handler in libgis
Glynn Clements
glynn at gclements.plus.com
Tue Feb 17 09:46:48 PST 2015
Sören Gebbert wrote:
> > AFAICT, this needs to be:
> >
> > CALLBACK = CFUNCTYPE(c_void_p, c_void_p)
> >
> > For callbacks, ctypesgen converts any return type which isn't a
> > primitive C type to c_void_p. And None isn't a primitive C type.
>
> thanks a lot, that solved the issue.
Actually, for forward compatibility, use:
CALLBACK = CFUNCTYPE(libgis.UNCHECKED(None), c_void_p)
I'm thinking that we might want to change the definition of UNCHECKED
so that UNCHECKED(None) == None.
I didn't want to mess with ctypesgen too much to make it easier to
sync with upstream. But if ctypesgen is abandoned (the last commit was
August 2013), that's not really an issue.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list