[capi-sig] Unicode compatibility

Daniel Stutzbach daniel at stutzbachenterprises.com
Mon May 24 19:09:52 CEST 2010

Robert, Stefan, thank you for your feedback.

How about the following variation, which I believe will address your

By default, Py_UNICODE will be a fully-specified type.  In a nutshell, the
default will behave just like Python 2 or 3.1, except that trying to load a
mismatched module will raise an ImportError with a more helpful error
message (much friendlier to novice programmers).  Cython would continue to
use this mode.

Extension authors who want a Unicode-agnostic build can specify an option in
their setup.py that will instruct distutils to pass a -D_Py_UNICODE_AGNOSTIC
compiler flag to ensure that all of their .c files are built in
Unicode-independent mode.  That way, the whole extension is compiled in the
same mode.

It would indeed be great if package managers included the Unicode setting as
part of the platform type.  PJE's proposed implementation of that feature (
http://bit.ly/1bO62) would allow eggs to specify UCS2, UCS4, or "Don't
Care". My patch greatly increases the number of eggs that could label
themselves "Don't Care", reducing maintenance work for package maintainers
who like to distribute binary eggs [1].  In other words, they are
complimentary solutions.

[1] A quick Google search of PyPi reveals many packages offering Linux
binary eggs.
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>

More information about the capi-sig mailing list