summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-09-21 23:01:17 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-09-21 23:01:17 (GMT)
commit6174474bea9fe6f5f12f05a16004eabb817ce721 (patch)
tree8a387e891d975f1ce1ff741f0f21b63926737660 /Objects/unicodeobject.c
parentca9381ea01211e79f5bc6078b95e177f1c04f52b (diff)
downloadcpython-6174474bea9fe6f5f12f05a16004eabb817ce721.zip
cpython-6174474bea9fe6f5f12f05a16004eabb817ce721.tar.gz
cpython-6174474bea9fe6f5f12f05a16004eabb817ce721.tar.bz2
_PyUnicodeWriter_PrepareInternal(): make the assertion more strict
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 7c079e0..d0b285a 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();