[Python-checkins] cpython: _PyUnicodeWriter: assert that max character <= MAX_UNICODE
victor.stinner
python-checkins at python.org
Tue Sep 6 20:03:56 EDT 2016
https://hg.python.org/cpython/rev/82017ba54447
changeset: 103177:82017ba54447
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Sep 06 16:58:36 2016 -0700
summary:
_PyUnicodeWriter: assert that max character <= MAX_UNICODE
files:
Objects/unicodeobject.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -13348,6 +13348,8 @@
Py_ssize_t newlen;
PyObject *newbuffer;
+ assert(maxchar <= MAX_UNICODE);
+
/* ensure that the _PyUnicodeWriter_Prepare macro was used */
assert((maxchar > writer->maxchar && length >= 0)
|| length > 0);
@@ -13441,6 +13443,7 @@
Py_LOCAL_INLINE(int)
_PyUnicodeWriter_WriteCharInline(_PyUnicodeWriter *writer, Py_UCS4 ch)
{
+ assert(ch <= MAX_UNICODE);
if (_PyUnicodeWriter_Prepare(writer, 1, ch) < 0)
return -1;
PyUnicode_WRITE(writer->kind, writer->data, writer->pos, ch);
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list