[Cython] Expected errors of tests/errors/cdef_members_T517.pxd

W. Trevor King wking at drexel.edu
Sun Feb 27 03:34:03 CET 2011


On Sat, Feb 26, 2011 at 10:15:38AM -0800, Robert Bradshaw wrote:
> On Sat, Feb 26, 2011 at 5:08 AM, W. Trevor King <wking at drexel.edu> wrote:
> > The relevant lines from tests/errors/cdef_members_T517.pxd are:
> >
> >    $ grep -n ^ tests/errors/cdef_members_T517.pyx
> >    ...
> >    8:ctypedef struct Foo:
> >    9:    int i
> >    10:
> >    11:cdef class Bar:
> >    12:    cdef          Foo foo0
> >    13:    cdef readonly Foo foo2
> >    14:    cdef public   Foo foo1
> >    15:    pass
> >    ...
>
> ...
>
> What's less clear is the behavior of
> 
>    b = Bar()
>    b.foo1 = Foo(i=1)
>    b.foo1.i = 100
>    print b.foo1
>    saved = b.foo1
>    del b
>    print saved

Is the problem choosing between:

1) Copy struct data into its own PyObject and let Python manage the
   memory.
2) Pass around a pointer to Cython-managed struct data.

I suppose I don't really know enough about how Cython handles this yet
to really see the problem or be able to help with a solution ;).

-- 
This email may be signed or encrypted with GPG (http://www.gnupg.org).
The GPG signature (if present) will be attached as 'signature.asc'.
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

My public key is at http://www.physics.drexel.edu/~wking/pubkey.txt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20110226/77e03781/attachment.pgp>


More information about the cython-devel mailing list