[issue3098] sys.sizeof test fails with wide unicode
Marc-Andre Lemburg
report at bugs.python.org
Fri Jun 13 21:51:42 CEST 2008
Marc-Andre Lemburg <mal at egenix.com> added the comment:
It's actually very easy:
Py_UNICODE is a 2-byte value for UCS-2 builds and 4 byte value for UCS-4
builds of Python.
print ((sys.maxunicode < 66000) and 'UCS2' or 'UCS4')
tells you which one you have.
Note that you should *not* use the exact value of 0x10FFFF for UCS-4 -
it's possible that the Unicode consortium decides to add more planes to
the Universal Character Set... (though not likely).
The above comparison is good enough to detect the number of bytes in a
single code point, though.
----------
nosy: +lemburg
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3098>
_______________________________________
More information about the Python-bugs-list
mailing list