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

Romain Guillebert romain.py at gmail.com
Mon Apr 18 17:55:58 CEST 2011


Hi

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


More information about the cython-devel mailing list