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 @@ -245,6 +245,29 @@ complete listing.
245245
246246 .. versionadded :: 3.4
247247
248+ .. c :macro :: Py_BUILD_ASSERT(cond)
249+
250+ Asserts a compile-time condition *cond *, as a statement.
251+ The build will fail if the condition is false or cannot be evaluated at compile time.
252+
253+ For example::
254+
255+ Py_BUILD_ASSERT(sizeof(PyTime_t) == sizeof(int64_t));
256+
257+ .. versionadded :: 3.3
258+
259+ .. c :macro :: Py_BUILD_ASSERT_EXPR(cond)
260+
261+ Asserts a compile-time condition *cond *, as an expression that evaluates to ``0 ``.
262+ The build will fail if the condition is false or cannot be evaluated at compile time.
263+
264+ For example::
265+
266+ #define foo_to_char(foo) \
267+ ((char *)(foo) + Py_BUILD_ASSERT_EXPR(offsetof(struct foo, string) == 0))
268+
269+ .. versionadded :: 3.3
270+
248271.. c :macro :: PyDoc_STRVAR(name, str)
249272
250273 Creates a variable with name *name * that can be used in docstrings.
Original file line number Diff line number Diff line change 225225# Temporary undocumented names.
226226# In future this list must be empty.
227227nitpick_ignore += [
228- # Undocumented public C macros
229- ('c:macro' , 'Py_BUILD_ASSERT' ),
230- ('c:macro' , 'Py_BUILD_ASSERT_EXPR' ),
231228 # Do not error nit-picky mode builds when _SubParsersAction.add_parser cannot
232229 # be resolved, as the method is currently undocumented. For context, see
233230 # https://github.com/python/cpython/pull/103289.
You can’t perform that action at this time.
0 commit comments