From: Victor Stinner Date: Mon, 21 Nov 2011 01:24:49 +0000 (+0100) Subject: PyUnicode_GET_SIZE() checks that PyUnicode_AsUnicode() succeed X-Git-Tag: v3.3.0a1~780 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f3ae6208c706bae89d86df44c7c3dcac1bdcd94d;p=python PyUnicode_GET_SIZE() checks that PyUnicode_AsUnicode() succeed using an assertion --- diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h index 6a31e48836..e1a5a2f5f7 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)