.. versionadded:: 3.4
+.. c:macro:: Py_BUILD_ASSERT(cond)
+
+ Asserts a compile-time condition *cond*, as a statement.
+ The build will fail if the condition is false or cannot be evaluated at compile time.
+
+ For example::
+
+ Py_BUILD_ASSERT(sizeof(PyTime_t) == sizeof(int64_t));
+
+ .. versionadded:: 3.3
+
+.. c:macro:: Py_BUILD_ASSERT_EXPR(cond)
+
+ Asserts a compile-time condition *cond*, as an expression that evaluates to ``0``.
+ The build will fail if the condition is false or cannot be evaluated at compile time.
+
+ For example::
+
+ #define foo_to_char(foo) \
+ ((char *)(foo) + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))
+
+ .. versionadded:: 3.3
+
.. c:macro:: PyDoc_STRVAR(name, str)
Creates a variable with name *name* that can be used in docstrings.
# Temporary undocumented names.
# In future this list must be empty.
nitpick_ignore += [
- # Undocumented public C macros
- ('c:macro', 'Py_BUILD_ASSERT'),
- ('c:macro', 'Py_BUILD_ASSERT_EXPR'),
# Do not error nit-picky mode builds when _SubParsersAction.add_parser cannot
# be resolved, as the method is currently undocumented. For context, see
# https://github.com/python/cpython/pull/103289.