[I18n-sig] UCS-4 configuration

Guido van Rossum guido@digicool.com
Wed, 27 Jun 2001 14:13:10 -0400

> To hack without Py_InitModule5, putting flags into PYTHON_API_VERSION
> might also work.

I like adding a flag better than Py_InitModule5.  If
PYTHON_API_VERSION > 1010, the low bit should be off for UCS-2 and on
for UCS-4.  So the next version should be 1012; this would become 1013
for UCS-4.

If a program doesn't use Unicode-specific APIs that take or return
Py_UNICODE arrays, it's not vulnerable to this problem.  An
alternative would be to use the C preprocessor to give all affected
APIs a different name when using UCS4.  (There are also macros
affected, e.g. Py_UNICODE_COPY().  But macro users are likely to also
refernce the function APIs.)

There's a bunch of functions that take or return a single Py_UNICODE
value.  These would be affected too.  That's a shame; if they had been
defined to take/return an unsigned long they would have worked just as

--Guido van Rossum (home page: http://www.python.org/~guido/)