summaryrefslogtreecommitdiff
path: root/Objects/stringlib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-03-09 20:49:52 +0200
committerGitHub <noreply@github.com>2020-03-09 20:49:52 +0200
commiteebaa9bfc593d5a46b293c1abd929fbfbfd28199 (patch)
tree9ba0bbaba8116eb71d0b80f11b586fe063aadbe5 /Objects/stringlib
parent6d0ee60740f2862a878f009671b1aaa75aeb0c2a (diff)
downloadcpython-git-eebaa9bfc593d5a46b293c1abd929fbfbfd28199.tar.gz
bpo-38249: Expand Py_UNREACHABLE() to __builtin_unreachable() in the release mode. (GH-16329)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Objects/stringlib')
-rw-r--r--Objects/stringlib/eq.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/Objects/stringlib/eq.h b/Objects/stringlib/eq.h
index ff22f91371..9c1058b86c 100644
--- a/Objects/stringlib/eq.h
+++ b/Objects/stringlib/eq.h
@@ -6,13 +6,14 @@
Py_LOCAL_INLINE(int)
unicode_eq(PyObject *aa, PyObject *bb)
{
+ assert(PyUnicode_Check(aa));
+ assert(PyUnicode_Check(bb));
+ assert(PyUnicode_IS_READY(aa));
+ assert(PyUnicode_IS_READY(bb));
+
PyUnicodeObject *a = (PyUnicodeObject *)aa;
PyUnicodeObject *b = (PyUnicodeObject *)bb;
- if (PyUnicode_READY(a) == -1 || PyUnicode_READY(b) == -1) {
- Py_UNREACHABLE();
- }
-
if (PyUnicode_GET_LENGTH(a) != PyUnicode_GET_LENGTH(b))
return 0;
if (PyUnicode_GET_LENGTH(a) == 0)