Stefan Behnel wrote:
> Dag Sverre Seljebotn wrote:
>> let all global values be referenced by a big tuple; then have each 
>> type and the module reference the tuple, but the tuple itself doesn't 
>> reference anything but the values themselves => no cycles.
> 
> Although "globals" would also include types, right? So there's our
> reference cycle back... (although that doesn't hit us until we really start
> moving types to the heap)

BTW, a tuple isn't enough here. I sometimes write things like this in my code:

        cdef str NAMESPACE = "http://sdffsadf.org/jhshdkflh/fsdfs";
        cdef char* _NAMESPACE = NAMESPACE

i.e. you'd need an extension class to also reference the module-local C
values, which may depend on module-local Python values.

Also note that the PEP has a way to store module-local state. Since this is
a Py3-only feature, we might just as well use that.

Stefan


_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to