[Python-checkins] cpython: PyUnicode_GET_SIZE() checks that PyUnicode_AsUnicode() succeed
victor.stinner
python-checkins at python.org
Mon Nov 21 02:50:22 CET 2011
http://hg.python.org/cpython/rev/98b8849d1a30
changeset: 73654:98b8849d1a30
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Mon Nov 21 02:24:49 2011 +0100
summary:
PyUnicode_GET_SIZE() checks that PyUnicode_AsUnicode() succeed
using an assertion
files:
Include/unicodeobject.h | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -385,12 +385,13 @@
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)
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list