Skip to content

gh-158886: Add macros of the limited C API to stable_abi.toml - #158887

Open
vstinner wants to merge 9 commits into
python:mainfrom
vstinner:stable_macros
Open

vstinner wants to merge 9 commits into
python:mainfrom
vstinner:stable_macros

Conversation

@vstinner

@vstinner vstinner commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

@vstinner
vstinner requested a review from a team as a code owner October 5, 2026 22:37
@vstinner

vstinner commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

The Doctest job fails with:

sphinx.errors.SphinxParallelError: sphinx.errors.ExtensionError: Handler <function add_annotations at 0x7af8150d5fd0> for event 'doctree-read' threw an exception (exception: Object type mismatch in limited API annotation for PyObject_New: 'function' != 'macro')

I documented PyObject_New() as a function in stable_abi.toml ([function.PyObject_New]) to fix to fix Doctest, but it doesn't work as expected.

Problem: macros declared as functions by stable_abi.toml are checked by Lib/test/test_stable_abi_ctypes.py which fails since they are macros and not functions...

@vstinner
vstinner marked this pull request as draft October 5, 2026 22:44
@vstinner

vstinner commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

I updated the PR to document all macros as macros, not as functions.

@vstinner

vstinner commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

Updated Doctest error:

sphinx.errors.SphinxParallelError: sphinx.errors.ExtensionError: Handler <function add_annotations at 0x7353c3fd9fd0> for event 'doctree-read' threw an exception (exception: Object type mismatch in limited API annotation for PyImport_ImportModuleEx: 'macro' != 'function')

@read-the-docs-community

read-the-docs-community Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34957345 | 📁 Comparing 1db4cb9 against main (eab2d16)

  🔍 Preview build  

33 files changed · ± 33 modified

± Modified

@vstinner

vstinner commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

I updated Doc/tools/extensions/c_annotations.py to accept that some documented functions are defined as macros by stable_abi.toml.

@vstinner
vstinner marked this pull request as ready for review October 5, 2026 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant