]> granicus.if.org Git - python/commitdiff
bpo-38376: Fix _PyUnicode_CheckConsistency() definition (GH-16623)
authorVictor Stinner <vstinner@python.org>
Mon, 7 Oct 2019 19:12:05 +0000 (21:12 +0200)
committerGitHub <noreply@github.com>
Mon, 7 Oct 2019 19:12:05 +0000 (21:12 +0200)
Always define _PyUnicode_CheckConsistency() in the CPython C API.

Include/cpython/unicodeobject.h
Include/internal/pycore_object.h
Include/unicodeobject.h

index c11503d3399921b5c38887ba9b2f582cb156de71..54a13e32ba22b55e64f9048ac3528037b35bf753 100644 (file)
@@ -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) ?                  \
index 81548f819198e375839ceb9ee060ffb5f5170ff2..7418c6936b8f0b8eda6cef18b65e11aa08de450a 100644 (file)
@@ -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.
index 6d141b37bf8909204454f73c8681c14e31f612b8..97d8cd12f6de5494a1c32140ade1857c47c89020 100644 (file)
@@ -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"