[Cython] Accessing C attributes from Python functions in the interpreter
Johannes Wienke
languitar at semipol.de
Sun Jun 8 01:24:11 CEST 2008
Hi,
maybe I've just got a lack of understanding or I don't know...
I've got a class that in general looks like this:
cpdef class Foo:
cdef char* myData
cdef void setData(Foo self, char *data)
self.myData = data
cpdef doSomething(Foo self)
print self.myData
The problem is that working with myData directly from Cython is no
problem but calling doSomething from the python interpreter causes a
segfault because self.myData then points to NULL. I've also observed
that self in setData points to a different address than self in
doSomething if it is called from the interpreter.
What's the problem with this approach?
Thanks
Johannes
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
Url : http://codespeak.net/pipermail/cython-dev/attachments/20080608/ea2a702d/attachment.pgp
More information about the Cython-dev
mailing list