Skip to content

[3.15] gh-140550: Fix PyABIInfo_VAR macro: avoid ";" - #157494

Merged
hugovk merged 2 commits into
python:3.15from
vstinner:abiinfo15
Sep 15, 2026
Merged

hugovk merged 2 commits into
python:3.15from
vstinner:abiinfo15

Conversation

@vstinner

@vstinner vstinner commented Sep 14, 2026

Copy link
Copy Markdown
Member

Remove ";" from PyABIInfo_VAR macro definition, since "PyABIInfo_VAR(abi_info);" added two ";;" which is illegal in C++03.

Remove ";" from PyABIInfo_VAR macro definition, since
"PyABIInfo_VAR(abi_info);" added two ";;" which is illegal in C++03.
@vstinner

Copy link
Copy Markdown
Member Author

@encukou: I found this bug while enabling limited C API tests on Free Threading in test_cppext for PR gh-157493. IMO we should fix this issue in Python 3.15.0. Otherwise, developers may start writing extensions as PyABIInfo_VAR(abi_info) (without ;) which is currently accepted.

I checked the documentation: PyABIInfo_VAR is always used as PyABIInfo_VAR(abi_info); (with ;).

@encukou encukou removed the skip news label Sep 14, 2026
@encukou

encukou commented Sep 14, 2026

Copy link
Copy Markdown
Member

I agree. Thanks for the catch!

It's @hugovk's call though. For context:
With the fix, existing extension modules will work, but some existing ones might fail to compile until they get a small source fix.
All docs show the “correct” way to use PyABIInfo_VAR, but, projects that compile with strict C++03 compliance settings might have adjusted and will now need adjusting back.

IMO, for C-wielding early adopters, a NEWS entry is enough.

@hugovk

hugovk commented Sep 14, 2026

Copy link
Copy Markdown
Member

Yes, let's have this fixed for 3.15.0, please add the NEWS entry.

Should this go into main first?

@vstinner

Copy link
Copy Markdown
Member Author

Yes, let's have this fixed for 3.15.0, please add the NEWS entry.

I added a NEWS entry.

Should this go into main first?

I extracted the PyABIInfo_VAR macro fix from my larger PR gh-157493. The main change is under review. (I just fixed test_cppext when using clang.)

@encukou

encukou commented Sep 15, 2026

Copy link
Copy Markdown
Member

Should this go into main first?

IMO it should, to keep the change & NEWS together, and make it easier to revert if there's some unforeseen weirdness. I sent #157539.

(If you think keeping this in the bigger change is better I won't object, but then add the NEWS entry there.)

@hugovk
hugovk merged commit 4b6de96 into python:3.15 Sep 15, 2026
54 checks passed
@hugovk

hugovk commented Sep 15, 2026

Copy link
Copy Markdown
Member

Thanks both, both merged!

@vstinner
vstinner deleted the abiinfo15 branch September 15, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants