Dag Sverre Seljebotn wrote:
> when modifying the testcase (r_doctests.pyx), I encountered a strange
> thing: If I made the doctest a unicode string, then Python 2.5 still
> wouldn't print it out with a u prefix in the doctest. Is this supposed to
> work differently?

No, that's the way docstrings work in Py2 for classes and modules, at
least at the C level (maybe also functions, don't remember). They are
passed as plain encoded byte strings (char*). Only Py3 decodes them from
UTF-8, Py2 takes them as they are.

This is definitely sub-optimal (thus the fix in Py3), and IIRC the current
implementation in Cython even encodes docstrings to UTF-8 to make them
work with Py3, even if they were originally byte strings encoded as, say,
latin-1. Might be worth another work-around for Py2 here...

Stefan

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to