From: Victor Stinner Date: Wed, 25 Apr 2012 22:37:21 +0000 (+0200) Subject: long_to_decimal_string() and _PyLong_Format() check the consistency of newly X-Git-Tag: v3.3.0a3~73^2~3^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3065093bb3798b6a4491f9c4a3bb6c10724a143b;p=python long_to_decimal_string() and _PyLong_Format() check the consistency of newly created strings using _PyUnicode_CheckConsistency() in debug mode --- diff --git a/Objects/longobject.c b/Objects/longobject.c index 3630ae4e19..74c59c7974 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -1657,6 +1657,7 @@ long_to_decimal_string(PyObject *aa) /* check we've counted correctly */ assert(p == PyUnicode_1BYTE_DATA(str)); + assert(_PyUnicode_CheckConsistency(str, 1)); Py_DECREF(scratch); return (PyObject *)str; } @@ -1761,6 +1762,7 @@ _PyLong_Format(PyObject *aa, int base) if (negative) *--p = '-'; assert(p == PyUnicode_1BYTE_DATA(v)); + assert(_PyUnicode_CheckConsistency(v, 1)); return v; }