summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Misc/NEWS4
-rw-r--r--Modules/_json.c2
-rw-r--r--Modules/_sha3/sha3module.c2
-rw-r--r--Modules/md5module.c2
-rw-r--r--Modules/sha1module.c2
-rw-r--r--Modules/sha256module.c2
-rw-r--r--Modules/sha512module.c2
7 files changed, 16 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index f1d55dd..7611c07 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -4501,6 +4501,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 68ebe99..2e1659e 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -210,7 +210,9 @@ ascii_escape_unicode(PyObject *pystr)
}
}
output[chars++] = '"';
+#ifdef Py_DEBUG
assert(_PyUnicode_CheckConsistency(rval, 1));
+#endif
return rval;
}
diff --git a/Modules/_sha3/sha3module.c b/Modules/_sha3/sha3module.c
index 4c3c6db..32cd85a 100644
--- a/Modules/_sha3/sha3module.c
+++ b/Modules/_sha3/sha3module.c
@@ -300,7 +300,9 @@ SHA3_hexdigest(SHA3object *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/md5module.c b/Modules/md5module.c
index 4ecbb06..6e15a20 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 ab93f68..52ef8a9 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 4abd1cd..3274e7c 100644
--- a/Modules/sha256module.c
+++ b/Modules/sha256module.c
@@ -456,7 +456,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 bfb022c..3e0f6ce 100644
--- a/Modules/sha512module.c
+++ b/Modules/sha512module.c
@@ -522,7 +522,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;
}