bpo-38376: Fix build error when enabling assertions but not Py_DEBUG. by Yhg1s · Pull Request #16594 · python/cpython (original) (raw)
FYI, this change was intended to keep visibility parity, because the existing declaration (not definition) of _PyUnicode_CheckConsistency in Include/unicodeobject.h was already conditional on NDEBUG or Py_DEBUG. The only other declaration was in Include/internal/pycore_object.h, which wouldn't be visible to user code in the same way as before. Moving the declaration to Include/cpython/unicodeobject.h as you did also solved that same problem, because that header is included by Include/unicodeobject.h when not using the limited API. We should be all good now.