_PyUnicodeWriter_PrepareInternal(): make the assertion more strict

This commit is contained in:
Victor Stinner 2015-09-22 01:01:17 +02:00
parent ca9381ea01
commit 6174474bea

View file

@ -13307,7 +13307,8 @@ _PyUnicodeWriter_PrepareInternal(_PyUnicodeWriter *writer,
PyObject *newbuffer;
/* ensure that the _PyUnicodeWriter_Prepare macro was used */
assert(maxchar > writer->maxchar || length > 0);
assert((maxchar > writer->maxchar && length >= 0)
|| length > 0);
if (length > PY_SSIZE_T_MAX - writer->pos) {
PyErr_NoMemory();