[Cython] trying to understand why PyString_GET_SIZE cannot be cimport-ed

Matti Picus matti.picus at gmail.com
Sun Jan 8 00:17:59 EST 2017


On 07/01/17 19:25, Matti Picus wrote:

> I am working on a branch of PyPy 2.7 to support Pandas (default PyPy 
> is missing some CAPI support that enables the parts of cython used in 
> Pandas).
> Pandas code has these lines (in lib.pyx)
>
> try:
>     from cpython cimport PyString_GET_SIZE
> except ImportError:
>     from cpython cimport PyUnicode_GET_SIZE as PyString_GET_SIZE
>
>
> For some reason, PyPy fails to cimport PyString_GET_SIZE, but 
> successfully cimports PyUnicode_GET_SIZE.
> The substitution causes problems for PyPy, I could solve those in a 
> different way, but I would like to understand what is going on.
>
> My cython Foo is improving but still too weak to understand why the 
> cimport fails, could someone help me out with a hint?
>
> Matti
Sorry for the noise, this would appear to be more appropriate for 
cython-users and also is just wrong, I will file a bug report with pandas.
Matti


More information about the cython-devel mailing list