[Python-Dev] Problems with the new unicodectype.c

M.-A. Lemburg mal@lemburg.com
Thu, 06 Jul 2000 11:52:17 +0200

Jack Jansen wrote:
> > BTW, if your compiler supports Unicode (that is provides
> > a working wctype.h file), you can compile Python using
> > the compile time switch --with-wctype-functions. Python
> > will then use the C libs iswXXX() APIs which should return
> > more or less the same values as the Python ones (could be that
> > the C lib is Unicode 2.0 -- so YMMV). Note that this hasn't
> > been tested much yet. Feedback is welcome.
> Unfortunately the native wctype implementation is apparently different enough
> that it makes test_unicode fail. But I've solved the problem by splitting the
> 5000-entry switch statement into multiple switches with 1000 entries each.
> That's good enough for the CodeWarrior compiler (which doesn't have the least
> problem with the tiny 256-case switch in ceval.c). It may not be good enough
> for people who have compilers with really low limits on the number of cases in
> a switch, though.
> I'll check it in shortly.

It might also be a good idea to add 

if (ch < 0x100) switch...

statements. Most Unicode chars will be in the Latin-1 range
anyway and this should improve performance.

I'll add these to the other switches in unicodectype.c too
after you've made your changes.

Marc-Andre Lemburg
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/