[Python-checkins] cpython: _PyUnicodeWriter_PrepareInternal(): make the assertion more strict
victor.stinner
python-checkins at python.org
Tue Sep 22 01:01:47 CEST 2015
https://hg.python.org/cpython/rev/ecee4ff91bf8
changeset: 98153:ecee4ff91bf8
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Sep 22 01:01:17 2015 +0200
summary:
_PyUnicodeWriter_PrepareInternal(): make the assertion more strict
files:
Objects/unicodeobject.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -13307,7 +13307,8 @@
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();
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list