| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
The name of an anonymous struct is an implementation detail, so it is
acceptable for the name to change between builds (e.g. from the old
anon_structXX / anon_unionXX scheme to the newer MODULE__anon_podXX
scheme that Cython now emits). This change makes the checker verify
that anonymous structs have the same *structure*, while tolerating name
changes, so spurious "Missing" / "Added" errors are no longer reported
for pure renames.
Three improvements:
1. `_format_base_type_name`: unwrap `CConstOrVolatileTypeNode` instead
of falling through to its class name. Const/volatile qualifiers do
not affect ABI layout, and the old behaviour stored the Python class
name literally ("CConstOrVolatileTypeNode*") in generated .abi.json
files, which caused field-type mismatches when comparing builds where
the qualifier was expressed differently.
2. `_build_anon_rename_map`: new iterative bottom-up pass that builds a
mapping from old-style anon names (expected) to new-style anon_pod
names (found) by matching field content. Leaf structs (no anon-type
fields) are matched first; each round normalises the remaining
candidates using already-known renames, allowing parent structs that
embed renamed children to match in subsequent rounds.
3. `_normalize_type`: uses `re.sub` with `\b` word-boundary anchors
instead of plain `str.replace`, so a shorter name like "anon_struct1"
cannot corrupt a longer one like "anon_struct12" if iteration order
happens to process the shorter key first.
`check_structs` is updated to look up each expected struct through the
rename map, normalise expected field types before comparing, and skip
the "Added" report for new-style names that are confirmed renames.
Note: baselines generated with the old tool (containing
"CConstOrVolatileTypeNode*" type strings) must be regenerated with the
fixed tool before the rename-matching logic can work correctly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-renames' into fix/check-cython-abi-anon-struct-renames
…i-anon-struct-renames
|
Sorry, something went wrong.
…VIDIA#2242) * toolshed: handle anonymous struct renames in check_cython_abi.py The name of an anonymous struct is an implementation detail, so it is acceptable for the name to change between builds (e.g. from the old anon_structXX / anon_unionXX scheme to the newer MODULE__anon_podXX scheme that Cython now emits). This change makes the checker verify that anonymous structs have the same *structure*, while tolerating name changes, so spurious "Missing" / "Added" errors are no longer reported for pure renames. Three improvements: 1. `_format_base_type_name`: unwrap `CConstOrVolatileTypeNode` instead of falling through to its class name. Const/volatile qualifiers do not affect ABI layout, and the old behaviour stored the Python class name literally ("CConstOrVolatileTypeNode*") in generated .abi.json files, which caused field-type mismatches when comparing builds where the qualifier was expressed differently. 2. `_build_anon_rename_map`: new iterative bottom-up pass that builds a mapping from old-style anon names (expected) to new-style anon_pod names (found) by matching field content. Leaf structs (no anon-type fields) are matched first; each round normalises the remaining candidates using already-known renames, allowing parent structs that embed renamed children to match in subsequent rounds. 3. `_normalize_type`: uses `re.sub` with `\b` word-boundary anchors instead of plain `str.replace`, so a shorter name like "anon_struct1" cannot corrupt a longer one like "anon_struct12" if iteration order happens to process the shorter key first. `check_structs` is updated to look up each expected struct through the rename map, normalise expected field types before comparing, and skip the "Added" report for new-style names that are confirmed renames. Note: baselines generated with the old tool (containing "CConstOrVolatileTypeNode*" type strings) must be regenerated with the fixed tool before the rename-matching logic can work correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Ignore private parts of the ABI --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
| Back | FazBrowse Home | New Git URL |
Summary
The name of an anonymous struct is an implementation detail, so it is acceptable for the name to change between builds (e.g. from the old anon_structXX / anon_unionXX scheme to the newer MODULE__anon_podXX scheme that Cython now emits). This checker now verifies that anonymous structs have the same structure, but tolerates name changes, so pure renames are no longer reported as errors.
Three changes in toolshed/check_cython_abi.py:
_format_base_type_name: unwrap CConstOrVolatileTypeNode instead of falling through to its Python class name. Const/volatile qualifiers don't affect ABI layout; the old behaviour stored "CConstOrVolatileTypeNode*" literally in .abi.json files, causing spurious field-type mismatches across builds that expressed the qualifier differently.
_build_anon_rename_map: new iterative bottom-up pass that builds a mapping from old-style anon names (in the baseline) to new-style anon_pod names (in the current build) by matching field content. Leaf structs are matched first; each round normalises remaining candidates using already-known renames, allowing parent structs that embed renamed children to be resolved in subsequent rounds.
_normalize_type: switched from str.replace to re.sub with \b word-boundary anchors, so a shorter name like anon_struct1 cannot corrupt a longer one like anon_struct12 due to iteration order.
check_structs is updated to look up each expected struct through the rename map, normalise expected field types before comparing, and suppress the "Added" report for new-style names that are confirmed renames.
Test plan
🤖 Generated with Claude Code