-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-99202: Fix extension type from documentation for compiling in C++20 mode #102518
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
Conversation
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
@vstinner @encukou @erlend-aasland @bruno-at-bareos as participants of the parent issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. IMO it's fine to use this syntax in the documentation for new extensions.
@encukou: What do you think?
Python 3.11 itself now targets C11: https://peps.python.org/pep-0007/#c-dialect Python still supports building extensions with older C standards and various C++ standards.
This actually looks great! I'm surprised that there aren't any obvious downsides! IMO it would be nice to introduce Victor, do you want to merge? (I can't commit to watching/fixing buildbots this week.) |
Merged, thanks! |
As noted in #99202, C++20 added support for designated initializers and fails to compile if you mix named and unnamed initializers.
The documentation currently includes a section "Defining Extension Types: Tutorial" that mixed named and unnamed initializers, so it will not compile as shown.
This PR adds names on the header macros, so they do now compile in C++20 mode. The change is only made in the demo documentation, not any "real" code.