summaryrefslogtreecommitdiffstats
path: root/Include/unicodeobject.h
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2012-01-31 23:22:23 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2012-01-31 23:22:23 (GMT)
commited27785b32f11e815f1029b6b9e393b5c16a7660 (patch)
tree6f71c6e8202e1936d82fcdf8090210e148bac78f /Include/unicodeobject.h
parent5ea5b67a0b5fb5f14ccbafda4a65b9eb3f56cc99 (diff)
downloadcpython-ed27785b32f11e815f1029b6b9e393b5c16a7660.zip
cpython-ed27785b32f11e815f1029b6b9e393b5c16a7660.tar.gz
cpython-ed27785b32f11e815f1029b6b9e393b5c16a7660.tar.bz2
Issue #13706: Add assertions to detect bugs earlier
Diffstat (limited to 'Include/unicodeobject.h')
-rw-r--r--Include/unicodeobject.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index c706fc2..6d580f4 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -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); \
} \