FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-141004: Document `Py_BUILD_ASSERT*` macros by StanFromIreland · Pull Request #141266 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
23 changes: 23 additions & 0 deletions Doc/c-api/intro.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,29 @@ complete listing.

.. 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.
Expand Down
3 changes: 0 additions & 3 deletions Doc/conf.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,6 @@
# 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.
Expand Down
Loading

Back | FazBrowse Home | New Git URL