[Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

Torsten Landschoff torsten.landschoff at dynamore.de
Thu Jul 11 00:10:02 CEST 2013


Hi Stefan,

sorry for the delay, I was in the US for parental leave. I had hoped to
find some time to work on the promised patch over there, but I fell short.

On 04/22/2013 02:28 PM, Stefan Behnel wrote:
> Please do. Just ask back on this list if there's anything that's not
> clear to you.
I attached my current (trivial) patch. Currently I only support a decorator

    @cython.noclear
    cdef class ...

to inhibit generation of tp_clear.

Before I continue with this approach I am wondering about the API. Is
noclear usable as a name? I think not because nobody will know what it
is talking about.
But I do not know how to press the information "do not generate the
tp_clear slot which will clear references to break reference cycles
during GC" into a short name.

Perhaps something along the lines of "@cython.gc_keep_references" or
"@cython.exempt_from_gc_cycle_breaker"!?

How should the decorator to completely disable GC for a class be called?
@cython.nogc? @cython.refcounted (because the class will only support
cleanup via reference counting)?

Any input appreciated.

Greetings, Torsten

-- 
DYNAmore Gesellschaft fuer Ingenieurdienstleistungen mbH
Torsten Landschoff

Office Dresden
Tel: +49-(0)351-4519587
Fax: +49-(0)351-4519561

mailto:torsten.landschoff at dynamore.de
http://www.dynamore.de

DYNAmore Gesellschaft für FEM Ingenieurdienstleistungen mbH
Registration court: Stuttgart, HRB 733694
Managing director: Prof. Dr. Karl Schweizerhof, Dipl.-Math. Ulrich Franz

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20130711/e77f6072/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Inhibit-tp_clear-generation-via-class-decorator.patch
Type: text/x-patch
Size: 7607 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20130711/e77f6072/attachment.bin>


More information about the cython-devel mailing list