[Python-checkins] bpo-38376: Fix _PyUnicode_CheckConsistency() definition (GH-16623)

Victor Stinner webhook-mailer at python.org
Mon Oct 7 15:12:20 EDT 2019


https://github.com/python/cpython/commit/435b2eeb7bc5b8ec264e900b38bcb3d76552d777
commit: 435b2eeb7bc5b8ec264e900b38bcb3d76552d777
branch: 3.8
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2019-10-07T21:12:05+02:00
summary:

bpo-38376: Fix _PyUnicode_CheckConsistency() definition (GH-16623)

Always define _PyUnicode_CheckConsistency() in the CPython C API.

files:
M Include/cpython/unicodeobject.h
M Include/internal/pycore_object.h
M Include/unicodeobject.h

diff --git a/Include/cpython/unicodeobject.h b/Include/cpython/unicodeobject.h
index c11503d339992..54a13e32ba22b 100644
--- a/Include/cpython/unicodeobject.h
+++ b/Include/cpython/unicodeobject.h
@@ -246,6 +246,10 @@ typedef struct {
     } data;                     /* Canonical, smallest-form Unicode buffer */
 } PyUnicodeObject;
 
+PyAPI_FUNC(int) _PyUnicode_CheckConsistency(
+    PyObject *op,
+    int check_content);
+
 /* Fast access macros */
 #define PyUnicode_WSTR_LENGTH(op) \
     (PyUnicode_IS_COMPACT_ASCII(op) ?                  \
diff --git a/Include/internal/pycore_object.h b/Include/internal/pycore_object.h
index 81548f819198e..7418c6936b8f0 100644
--- a/Include/internal/pycore_object.h
+++ b/Include/internal/pycore_object.h
@@ -11,7 +11,6 @@ extern "C" {
 #include "pycore_pystate.h"   /* _PyRuntime */
 
 PyAPI_FUNC(int) _PyType_CheckConsistency(PyTypeObject *type);
-PyAPI_FUNC(int) _PyUnicode_CheckConsistency(PyObject *op, int check_content);
 PyAPI_FUNC(int) _PyDict_CheckConsistency(PyObject *mp, int check_content);
 
 /* Tell the GC to track this object.
diff --git a/Include/unicodeobject.h b/Include/unicodeobject.h
index 6d141b37bf890..97d8cd12f6de5 100644
--- a/Include/unicodeobject.h
+++ b/Include/unicodeobject.h
@@ -1032,16 +1032,6 @@ PyAPI_FUNC(int) PyUnicode_IsIdentifier(PyObject *s);
 
 /* === Characters Type APIs =============================================== */
 
-#if defined(Py_DEBUG) && !defined(Py_LIMITED_API)
-PyAPI_FUNC(int) _PyUnicode_CheckConsistency(
-    PyObject *op,
-    int check_content);
-#elif !defined(NDEBUG)
-/* For asserts that call _PyUnicode_CheckConsistency(), which would
- * otherwise be a problem when building with asserts but without Py_DEBUG. */
-#define _PyUnicode_CheckConsistency(op, check_content) PyUnicode_Check(op)
-#endif
-
 #ifndef Py_LIMITED_API
 #  define Py_CPYTHON_UNICODEOBJECT_H
 #  include  "cpython/unicodeobject.h"



More information about the Python-checkins mailing list