From: Christian Heimes Date: Thu, 3 Jan 2013 08:21:55 +0000 (+0100) Subject: Issue #16847: Fixed improper use of _PyUnicode_CheckConsistency() in X-Git-Tag: v3.3.1rc1~425 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f402e922f36a1f5fb5cc8fd87022761c6ee68c20;p=thirdparty%2FPython%2Fcpython.git Issue #16847: Fixed improper use of _PyUnicode_CheckConsistency() in non-pydebug builds. Several extension modules now compile cleanly when assert()s are enabled in standard builds (-DDEBUG flag). --- diff --git a/Misc/NEWS b/Misc/NEWS index e4fd504eb3ef..41126a6e436d 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -4293,6 +4293,10 @@ Tools/Demos Extension Modules ----------------- +- Issue #16847: Fixed improper use of _PyUnicode_CheckConsistency() in + non-pydebug builds. Several extension modules now compile cleanly when + assert()s are enabled in standard builds (-DDEBUG flag). + - Issue #13840: The error message produced by ctypes.create_string_buffer when given a Unicode string has been fixed. diff --git a/Modules/_json.c b/Modules/_json.c index 5b42f6f71862..db45c28fe403 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -246,7 +246,9 @@ ascii_escape_unicode(PyObject *pystr) } } output[chars++] = '"'; +#ifdef Py_DEBUG assert(_PyUnicode_CheckConsistency(rval, 1)); +#endif return rval; } diff --git a/Modules/md5module.c b/Modules/md5module.c index e2681a8ae5a5..12e187cb9402 100644 --- a/Modules/md5module.c +++ b/Modules/md5module.c @@ -399,7 +399,9 @@ MD5_hexdigest(MD5object *self, PyObject *unused) c = (digest[i] & 0xf); hex_digest[j++] = Py_hexdigits[c]; } +#ifdef Py_DEBUG assert(_PyUnicode_CheckConsistency(retval, 1)); +#endif return retval; } diff --git a/Modules/sha1module.c b/Modules/sha1module.c index a733c4b5bb17..09b87ef25022 100644 --- a/Modules/sha1module.c +++ b/Modules/sha1module.c @@ -376,7 +376,9 @@ SHA1_hexdigest(SHA1object *self, PyObject *unused) c = (digest[i] & 0xf); hex_digest[j++] = Py_hexdigits[c]; } +#ifdef Py_DEBUG assert(_PyUnicode_CheckConsistency(retval, 1)); +#endif return retval; } diff --git a/Modules/sha256module.c b/Modules/sha256module.c index 76d91afda37a..9f6b41639c1e 100644 --- a/Modules/sha256module.c +++ b/Modules/sha256module.c @@ -466,7 +466,9 @@ SHA256_hexdigest(SHAobject *self, PyObject *unused) c = (digest[i] & 0xf); hex_digest[j++] = Py_hexdigits[c]; } +#ifdef Py_DEBUG assert(_PyUnicode_CheckConsistency(retval, 1)); +#endif return retval; } diff --git a/Modules/sha512module.c b/Modules/sha512module.c index 88f8a64d0624..5536fd5c1c8e 100644 --- a/Modules/sha512module.c +++ b/Modules/sha512module.c @@ -532,7 +532,9 @@ SHA512_hexdigest(SHAobject *self, PyObject *unused) c = (digest[i] & 0xf); hex_digest[j++] = Py_hexdigits[c]; } +#ifdef Py_DEBUG assert(_PyUnicode_CheckConsistency(retval, 1)); +#endif return retval; }