[Cython] Fwd: working patch for generating code targeting Py 2.6 and Py 3.0

Stefan Behnel stefan_ml at behnel.de
Fri May 9 13:50:15 CEST 2008


Hi,

Stefan Behnel wrote:
> For current Cython code, this should just work unchanged - assuming you import
> the string compatibility header file that #defines PyString_* as PyBytes_*.

sorry for the confusion: there is no special header involved. The current API
in Py3.0a5 uses these names:

    bytearray -> PyBytes_*
    bytes     -> PyString_*
    str       -> PyUnicode_*

Described here

http://www.python.org/dev/peps/pep-3137/

with a summary here:

http://www.python.org/dev/peps/pep-3137/#summary

We should eventually special case bytearray(b'') literals, although that is
not strictly required. It's more important to actually support these types and
the coercion between them first. ;)

Stefan


More information about the Cython-dev mailing list