File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,29 @@ complete listing.
233233
234234 .. versionadded :: 3.4
235235
236+ .. c :macro :: Py_BUILD_ASSERT(cond)
237+
238+ Asserts a compile-time condition *cond *, as a statement.
239+ The build will fail if the condition is false or cannot be evaluated at compile time.
240+
241+ For example::
242+
243+ Py_BUILD_ASSERT(sizeof(PyTime_t) == sizeof(int64_t));
244+
245+ .. versionadded :: 3.3
246+
247+ .. c :macro :: Py_BUILD_ASSERT_EXPR(cond)
248+
249+ Asserts a compile-time condition *cond *, as an expression that evaluates to ``0 ``.
250+ The build will fail if the condition is false or cannot be evaluated at compile time.
251+
252+ For example::
253+
254+ #define foo_to_char(foo) \
255+ ((char *)(foo) + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))
256+
257+ .. versionadded :: 3.3
258+
236259.. c :macro :: PyDoc_STRVAR(name, str)
237260
238261 Creates a variable with name *name * that can be used in docstrings.
Original file line number Diff line number Diff line change 226226# Temporary undocumented names.
227227# In future this list must be empty.
228228nitpick_ignore += [
229- # Undocumented public C macros
230- ('c:macro' , 'Py_BUILD_ASSERT' ),
231- ('c:macro' , 'Py_BUILD_ASSERT_EXPR' ),
232229 # Do not error nit-picky mode builds when _SubParsersAction.add_parser cannot
233230 # be resolved, as the method is currently undocumented. For context, see
234231 # https://github.com/python/cpython/pull/103289.
You can’t perform that action at this time.
0 commit comments