8000 GH-121970: Rewrite the C-API annotations extension by AA-Turner · Pull Request #121985 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-121970: Rewrite the C-API annotations extension #121985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use standard comments; add a cross-reference in gen_doc_annotations
  • Loading branch information
AA-Turner committed Jul 19, 2024
commit 9b83e8192aa19a03024831be5fc461e6b01e38ae
28 changes: 14 additions & 14 deletions Doc/tools/extensions/c_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,33 @@

@dataclasses.dataclass(slots=True)
class RefCountEntry:
#: Name of the function.
# Name of the function.
name: str
#: List of (argument name, type, refcount effect) tuples.
# List of (argument name, type, refcount effect) tuples.
# (Currently not used. If it was, a dataclass might work better.)
args: list = dataclasses.field(default_factory=list)
#: Return type of the function.
# Return type of the function.
result_type: str = ''
#: Reference count effect for the return value.
# Reference count effect for the return value.
result_refs: int | None = None


@dataclasses.dataclass(frozen=True, slots=True)
class StableABIEntry:
#: Role of the object.
#: Source: Each [item_kind] in stable_abi.toml is mapped to a C Domain role.
# Role of the object.
# Source: Each [item_kind] in stable_abi.toml is mapped to a C Domain role.
role: str
#: Name of the object.
#: Source: [<item_kind>.*] in stable_abi.toml.
# Name of the object.
# Source: [<item_kind>.*] in stable_abi.toml.
name: str
#: Version when the object was added to the stable ABI.
#: (Source: [<item_kind>.*.added] in stable_abi.toml.
# Version when the object was added to the stable ABI.
# (Source: [<item_kind>.*.added] in stable_abi.toml.
added: str
#: An explananatory blurb for the ifdef.
#: Source: ``feature_macro.*.doc`` in stable_abi.toml.
# An explananatory blurb for the ifdef.
# Source: ``feature_macro.*.doc`` in stable_abi.toml.
ifdef_note: str
#: Defines how much of the struct is exposed. Only relevant for structs.
#: Source: [<item_kind>.*.struct_abi_kind] in stable_abi.toml.
# Defines how much of the struct is exposed. Only relevant for structs.
# Source: [<item_kind>.*.struct_abi_kind] in stable_abi.toml.
struct_abi_kind: str


Expand Down
6 changes: 5 additions & 1 deletion Tools/build/stable_abi.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ def sort_key(item):

@generator("doc_list", 'Doc/data/stable_abi.dat')
def gen_doc_annotations(manifest, args, outfile):
"""Generate/check the stable ABI list for documentation annotations"""
"""Generate/check the stable ABI list for documentation annotations

See ``StableABIEntry`` in ``Doc/tools/extensions/c_annotations.py``
for a description of each field.
"""
writer = csv.DictWriter(
outfile,
['role', 'name', 'added', 'ifdef_note', 'struct_abi_kind'],
Expand Down
Loading
0