[Pyrex] Passing c pointers to a class method

John (J5) Palmieri johnp at redhat.com
Tue May 4 20:54:00 CEST 2004


On Tue, 2004-05-04 at 14:43, Phillip J. Eby wrote:
> At 02:38 PM 5/4/04 -0400, John (J5) Palmieri wrote:
> >Hello all,
> >
> >How come something like this works:
> >
> >cdef test (void *ptr):
> >    pass
> >
> >test (somepointer)
> >
> >Yet this spits out "Cannot convert 'void (*)' to Python object":
> >
> >cdef class testclass:
> >     cdef test (self, void *ptr):
> >         pass
> >
> >mytest=testclass()
> >mytest.test(somepointer)
> 
> 
> 'test' isn't a classmethod, that's why.
> 
> Is there even such a thing as a cdef classmethod?

Ok, so is there a way to pass a C pointer into a method?  I inherited
the DBus Python bindings and originally they were just being cast as
python object and recast later to sidestep the problem.  This seems to
be the cause of some stack corruption so I am trying to find another
solution. 

-- 
John (J5) Palmieri
Associate Software Engineer
Desktop Group
Red Hat, Inc.
Blog: http://martianrock.com





More information about the Pyrex mailing list