[Cython] [GSoC] Python backend for Cython using PyPy's FFI

Stefan Behnel stefan_ml at behnel.de
Tue Apr 19 07:59:04 CEST 2011


Romain Guillebert, 18.04.2011 17:55:
> I investigated the code produced by Cython, and I see 3 cases which
> should be handled :
>
> * A pure python variable which has a value assigned (including None)
> * A pure python variable which has no value assigned
> * A C variable (we can't test if they are set of not)
>
> The first and second one seem relatively easy to implement it can
> reuse __pyx_string_tab.
> The code will call __Pyx_GetName on each element of the array, if it
> returns NULL, don't put the variable in the dictionary, else put the
> name and it's value in the dictionary.
> For the last one, it will probably need the C name, C type and Python
> name of each C variable, add the python name in the dictionary and wrap
> the C value into a Python object.
>
> However this will only provide read access to the globals. To offer
> read/write access, making a proxy dictionary is probably the most
> straightforward implementation (it can be rather inefficient though
> since we need to do an if/else to compare the value we want to set with
> every C globals).
>
> Do you think I'm on the right way ?

Thanks, Romain. Certainly sounds "good enough" to me.

Stefan


More information about the cython-devel mailing list