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

Matti Picus matti.picus at gmail.com
Sat Jan 7 12:25:33 EST 2017


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


More information about the cython-devel mailing list