[Cython] [cython] Hide Cython utility classes (like memoryview) from Python level module scope. (#222)

Stefan Behnel stefan_ml at behnel.de
Sun May 5 13:03:54 CEST 2013


Nikita Nemkin, 04.05.2013 19:52:
> Two changes included:
> 
> 1) cdef classes in utility code can have compiler directives attached to them. This is not used anywhere ATM, but memoryviews may benefit from ``@cython.final``.
> 
> 2) All utility classes are excluded from module dictionary by *implicitly* marking them with ``@cython.internal`` . This fixes [#775](http://trac.cython.org/cython_trac/ticket/775), test is included.
> 
> I don't quite understand what CythonScope is and how utility classes are *supposed* to be hidden, but as it is now, utility code scope is merged into main module scope and there is nothing special about its classes.
> 
> BTW if a user declares his own class with the same name as utility class (for example, ``memoryview``), everything breaks down.
> You can merge this Pull Request by running:
> 
>   git pull https://github.com/nnemkin/cython cy_utility_decorators
> 
> Or you can view, comment on it, or merge it online at:
> 
>   https://github.com/cython/cython/pull/222

I wonder why utility classes actually need a Python name. Can't they just
live with None as "name"? All they should really need is their cname and a
properly analysed entry stored in the right places, so deleting their
Python visible name when merging them into the main module should fix this.

Stefan



More information about the cython-devel mailing list