[Cython] Potential bug: hole in "C <-> Python" conversion

Stefan Behnel stefan_ml at behnel.de
Fri Jun 29 11:42:26 CEST 2012


Dieter Maurer, 29.06.2012 11:25:
> I have
> 
> cdef extern from *:
>         ctypedef char const_unsigned_char "const unsigned char"

This is an incorrect declaration. "char" != "unsigned char".


> cdef const_unsigned_char *c_data = data
> 
> leads to "Cannot convert Python object to 'const_unsigned_char *'"
> while "cdef char *c_data = data" works.
> 
> Should the "ctypedef char const_unsigned_char" not ensure
> that "char" and "const_unsigned_char" are used as synonyms?

I assume you are not using the latest Cython (0.17pre) from github, are
you? It should have a fix for this.

Also note that libc.string contains declarations for "const char*" and friends.

Stefan


More information about the cython-devel mailing list