[Pyrex] [Cython] Python 3

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Apr 30 00:36:01 CEST 2008


Christian Heimes wrote:

> In Python 3.x the PyUnicode object keeps a default encoded PyString in
> its struct. You can use PyUnicode_AsStringAndSize() to get an UTF8
> encoded char* from a PyUnicode object without worrying about memory
> management.

Thanks, I didn't know that.

So it seems that we could, if it were considered desirable,
have an automatic cast from unicode to char *. But the encoding
would *have* to be utf8 -- anything else would require memory
allocation.

-- 
Greg



More information about the Pyrex mailing list