AFAIK, *(unsigned char*)s is always smaller than 256.
except when it isn't. see the ANSI C spec for details.
Ah. I found. I'm very surprised for that. Thank you! :-) BTW, do we really support architectures with 9bits-sized char?
I would expect that a lot of our code assumes 8-bit characters, and I personally wouldn't mind if Python was limited to such platforms. They aren't very important for attracting new users, and certainly they don't seem to be a growing kind of platform... (Probably because so much other software makes the same assumption. :-)
So IMO your fix is fine.
--Guido van Rossum (home page: http://www.python.org/%7Eguido/)