[Python-checkins] cpython (3.3): Issue #16847: Fixed improper use of _PyUnicode_CheckConsistency() in

christian.heimes python-checkins at python.org
Thu Jan 3 09:23:03 CET 2013


http://hg.python.org/cpython/rev/944e86223d1f
changeset:   81271:944e86223d1f
branch:      3.3
parent:      81267:5f96e4619ceb
user:        Christian Heimes <christian at cheimes.de>
date:        Thu Jan 03 09:21:55 2013 +0100
summary:
  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).

files:
  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(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -4293,6 +4293,10 @@
 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
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -246,7 +246,9 @@
         }
     }
     output[chars++] = '"';
+#ifdef Py_DEBUG
     assert(_PyUnicode_CheckConsistency(rval, 1));
+#endif
     return rval;
 }
 
diff --git a/Modules/md5module.c b/Modules/md5module.c
--- a/Modules/md5module.c
+++ b/Modules/md5module.c
@@ -399,7 +399,9 @@
         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
--- a/Modules/sha1module.c
+++ b/Modules/sha1module.c
@@ -376,7 +376,9 @@
         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
--- a/Modules/sha256module.c
+++ b/Modules/sha256module.c
@@ -466,7 +466,9 @@
         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
--- a/Modules/sha512module.c
+++ b/Modules/sha512module.c
@@ -532,7 +532,9 @@
         c = (digest[i] & 0xf);
         hex_digest[j++] = Py_hexdigits[c];
     }
+#ifdef Py_DEBUG
     assert(_PyUnicode_CheckConsistency(retval, 1));
+#endif
     return retval;
 }
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list