[Python-Dev] unicode/string asymmetries

Neil Hodgson nhodgson@bigpond.net.au
Fri, 11 Jan 2002 10:06:06 +1100


Martin:

> ... So I'd
> suggest you just put an assertion into the code that Py_UNICODE is the
> same size as WCHAR (that can be even done through a preprocessor
> #error, using the _SIZE #defines). I'll expect people will resist
> changing Py_UNICODE on Windows for quite some time, even if other
> platforms move on.

   OK, I've turned off the wide character functions when Py_UNICODE_WIDE
defined. It even compiles in wide mode although with a lot (about 30)
warnings. The warnings are because I'm avoiding the wide char functions with
a runtime check rather than a compile time check as the preprocessor checks
would get messy with the extra case. The wide mode settings I used were:
#define PY_UNICODE_TYPE unsigned long
#define Py_UNICODE_SIZE SIZEOF_LONG

   Why isn't Py_UNICODE_SIZE defined as

#define Py_UNICODE_SIZE sizeof(PY_UNICODE_TYPE)
   ?

   Changes at
http://scintilla.sourceforge.net/winunichanges.zip

   Neil