summaryrefslogtreecommitdiffstats
path: root/Include/unicodeobject.h
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-11-21 01:24:49 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-11-21 01:24:49 (GMT)
commitf3ae6208c706bae89d86df44c7c3dcac1bdcd94d (patch)
tree95f8240c38cd11caaab5aea5aff99aa366b6253f /Include/unicodeobject.h
parentdcbbd9ea21fdeb0298e5baca82eeca1b3d7882cc (diff)
downloadcpython-f3ae6208c706bae89d86df44c7c3dcac1bdcd94d.zip
cpython-f3ae6208c706bae89d86df44c7c3dcac1bdcd94d.tar.gz
cpython-f3ae6208c706bae89d86df44c7c3dcac1bdcd94d.tar.bz2
PyUnicode_GET_SIZE() checks that PyUnicode_AsUnicode() succeed
using an assertion
Diffstat (limited to 'Include/unicodeobject.h')
-rw-r--r--Include/unicodeobject.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 6a31e48..e1a5a2f 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -385,12 +385,13 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
If the Py_UNICODE representation is not available, it will be computed
on request. Use PyUnicode_GET_LENGTH() for the length in code points. */
-#define PyUnicode_GET_SIZE(op) \
- (assert(PyUnicode_Check(op)), \
- (((PyASCIIObject *)(op))->wstr) ? \
- PyUnicode_WSTR_LENGTH(op) : \
- ((void)PyUnicode_AsUnicode((PyObject *)(op)), \
- PyUnicode_WSTR_LENGTH(op)))
+#define PyUnicode_GET_SIZE(op) \
+ (assert(PyUnicode_Check(op)), \
+ (((PyASCIIObject *)(op))->wstr) ? \
+ PyUnicode_WSTR_LENGTH(op) : \
+ ((void)PyUnicode_AsUnicode((PyObject *)(op)), \
+ assert(((PyASCIIObject *)(op))->wstr), \
+ PyUnicode_WSTR_LENGTH(op)))
#define PyUnicode_GET_DATA_SIZE(op) \
(PyUnicode_GET_SIZE(op) * Py_UNICODE_SIZE)