From f402e922f36a1f5fb5cc8fd87022761c6ee68c20 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Thu, 3 Jan 2013 09:21:55 +0100 Subject: 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). --- Misc/NEWS | 4 ++++ Modules/_json.c | 2 ++ Modules/md5module.c | 2 ++ Modules/sha1module.c | 2 ++ Modules/sha256module.c | 2 ++ Modules/sha512module.c | 2 ++ 6 files changed, 14 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index e4fd504..41126a6 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 5b42f6f..db45c28 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 e2681a8..12e187c 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 a733c4b..09b87ef 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 76d91af..9f6b416 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 88f8a64..5536fd5 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; } -- cgit v0.12