Hi Stefan,

On 07/14/2013 10:39 AM, Stefan Behnel wrote:
Torsten Landschoff, 11.07.2013 00:10:
I attached my current (trivial) patch. Currently I only support a decorator

    @cython.noclear
    cdef class ...

to inhibit generation of tp_clear.
Thanks, looks ok to me. Please open a pull request on github for it.
I'd like to remove some code duplication I introduced in my changes and add the feature to exclude specific attributes from clearing.
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.
I think that name is as good as any. It could be "no_gc_clear", if you find
that clearer. It hints at GC, at least. I think that should be part of the
name somehow.
Agreed.
So there will be the following decorator:

@cython.no_gc_clear
class ...

to disable generation of the clear method and

@cython.no_gc
class ...

to disable GC entirely. Okay for you?

I'd also like to support

@cython.no_gc_clear("keepthis", "keepthat")

to omit specific attributes from clear handling. I am not sure though how to declare that decorator in directive_types. Would something like this work:

directive_types = {
    'final' : bool,  # final cdef classes and methods
    # ...
    'no_gc_clear': one_of('bool', 'list'),
    # ...
}
?? How would I tell the parser that it should accept the strings as *args of the decorator (if you know what I mean)?
Please also document it somewhere in the extension types doc section (in
the user guide):

https://github.com/cython/cython/blob/master/docs/src/userguide/extension_types.rst
Thanks for the pointer, I was wondering about the right documentation set to change.

Greetings, Torsten
-- 
DYNAmore Gesellschaft fuer Ingenieurdienstleistungen mbH
Torsten Landschoff

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

mailto:torsten.landschoff@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