diff options
| author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-20 18:56:05 +0100 |
|---|---|---|
| committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-11-20 18:56:05 +0100 |
| commit | 77faf69ca1e024cd48c82c882bfcad34be05da63 (patch) | |
| tree | 63bb76b978bb287516a1978617d4f6b53df3d6f9 /Objects/unicodeobject.c | |
| parent | d5c4022d2abc67ef72de326bb12023bb969e80a9 (diff) | |
| download | cpython-git-77faf69ca1e024cd48c82c882bfcad34be05da63.tar.gz | |
_PyUnicode_CheckConsistency() also checks maxchar maximum value,
not only its minimum value
Diffstat (limited to 'Objects/unicodeobject.c')
| -rw-r--r-- | Objects/unicodeobject.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 18780ea4a4..9c1705d0dd 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -392,15 +392,21 @@ _PyUnicode_CheckConsistency(PyObject *op, int check_content) maxchar = ch; } if (kind == PyUnicode_1BYTE_KIND) { - if (ascii->state.ascii == 0) + if (ascii->state.ascii == 0) { assert(maxchar >= 128); + assert(maxchar <= 255); + } else assert(maxchar < 128); } - else if (kind == PyUnicode_2BYTE_KIND) + else if (kind == PyUnicode_2BYTE_KIND) { assert(maxchar >= 0x100); - else + assert(maxchar <= 0xFFFF); + } + else { assert(maxchar >= 0x10000); + assert(maxchar <= 0x10FFFF); + } } if (check_content && !unicode_is_singleton(op)) assert(ascii->hash == -1); |
