[Cython] Accessing C attributes from Python functions in the interpreter
Johannes Wienke
jwienke at techfak.uni-bielefeld.de
Sun Jun 8 02:05:00 CEST 2008
Am 06/08/2008 02:00 AM schrieb Robert Bradshaw:
> Where are you setting your myData? If you do
>
> Foo().doSomething()
>
> then it will segfault because the data isn't set yet. If you have
>
> def set_data_from_python(self, py_string):
> self.myData = py_string
>
> Then the conversion will happen, but myData is set to point to the
> inside of py_string (i.e. no copying is actually done) and so the
> instant py_string gets deallocated the actual char* gets reclaimed.
That's not the problem. My data is set by an external library that I
have opened before. I've also double-checked that it is set. But somehow
in another self than the one used when calling the data.
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/f9004674/attachment.pgp
More information about the Cython-dev
mailing list