[issue3098] sys.sizeof test fails with wide unicode

Robert Schuppenies report at bugs.python.org
Fri Jun 13 21:42:06 CEST 2008


Robert Schuppenies <okkotonushi at googlemail.com> added the comment:

sys.maxunicode is well defined to be either 0xFFFF for UCS-2
or 0x10FFFF for UCS-4 (see PyUnicode_GetMax).

Py_UNICODE_SIZE is set in pyconfig.h to be either 2 or 4 during
configuration. When >= 4, Py_UNICODE_WIDE is set which again influences
sys.maxunicode.

Thus, it currently is possible to derive Py_UNICODE_SIZE from
sys.maxunicode. But it takes some indirections.

So here are 2 possible patches, one which exposes Py_UNICODE_SIZE via
_testcapi and one which assumes that sys.maxunicode reflects UCS-X
settings. Since I am a fairly new Python developer and the new
4-eyes-per-commit policy for the beta phase, please decide which patch
should be applied.

Added file: http://bugs.python.org/file10624/Py_UNICODE.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3098>
_______________________________________


More information about the Python-bugs-list mailing list