mirror of
https://github.com/python/cpython.git
synced 2025-07-17 16:25:18 +00:00
Issue #13706: Add assertions to detect bugs earlier
This commit is contained in:
parent
5ea5b67a0b
commit
ed27785b32
2 changed files with 12 additions and 3 deletions
|
@ -499,14 +499,17 @@ enum PyUnicode_Kind {
|
|||
do { \
|
||||
switch ((kind)) { \
|
||||
case PyUnicode_1BYTE_KIND: { \
|
||||
assert(value <= 0xff); \
|
||||
((Py_UCS1 *)(data))[(index)] = (Py_UCS1)(value); \
|
||||
break; \
|
||||
} \
|
||||
case PyUnicode_2BYTE_KIND: { \
|
||||
assert(value <= 0xffff); \
|
||||
((Py_UCS2 *)(data))[(index)] = (Py_UCS2)(value); \
|
||||
break; \
|
||||
} \
|
||||
default: { \
|
||||
assert(value <= 0x10ffff); \
|
||||
assert((kind) == PyUnicode_4BYTE_KIND); \
|
||||
((Py_UCS4 *)(data))[(index)] = (Py_UCS4)(value); \
|
||||
} \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue