From: Victor Stinner Date: Mon, 21 Sep 2015 23:01:17 +0000 (+0200) Subject: _PyUnicodeWriter_PrepareInternal(): make the assertion more strict X-Git-Tag: v3.6.0a1~1483 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6174474bea9fe6f5f12f05a16004eabb817ce721;p=python _PyUnicodeWriter_PrepareInternal(): make the assertion more strict --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 7c079e0799..d0b285abac 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -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();