-
-
Notifications
You must be signed in to change notification settings - Fork 34k
gh-141004: Reorganize and reword the 'Useful macros' section #144471
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
- Group the macros - Roughly order them to put the most important ones first - Add expansions where it makes sense; especially if there's an equivalent in modern C or a common compiler
vstinner
left a comment
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.
Since you're already moving many functions, it may be interesting to sort functions in each category.
|
|
||
| A use for ``Py_UNREACHABLE()`` is following a call a function that | ||
| never returns but that is not declared :c:macro:`_Py_NO_RETURN`. | ||
| never returns but that is not declared ``_Noreturn``. |
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.
Note: C11 added _Noreturn, but C23 adds [[noreturn]] and deprecates _Noreturn.
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.
I'm aware, but don't want to get in the details too much.
We require C11, and as far as I know, deprecations in the C standard don't mean planned removal.
Co-authored-by: Victor Stinner <vstinner@python.org>
Sort by what? |
I'm thinking at the alphabetical order. |
|
Sorry, I just caused conflicts here with #144279. |
|
More macros -- more structure. How does this version look? I've grouped them in categories, and sorted by relevance first, alphabet second. For example, FWIW, I think combined entries are a great way to reduce duplication for things that do almost the same thing: |
ZeroIntensity
left a comment
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.
Mostly LGTM, with two little things below.
vstinner
left a comment
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. I like the new organization.
Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
ZeroIntensity
left a comment
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 as well, thanks for the cleanup!
|
Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14. |
…ythonGH-144471) - Group the macros - Roughly order them to put the most important ones first - Add expansions where it makes sense; especially if there's an equivalent in modern C or a common compiler (cherry picked from commit f85e1170d2b22d2ee42cd568144e0c9f57b0db67) Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
|
Sorry, @encukou, I could not cleanly backport this to |
|
GH-144541 is a backport of this pull request to the 3.14 branch. |
…H-144471) (GH-144541) - Group the macros - Roughly order them to put the most important ones first - Add expansions where it makes sense; especially if there's an equivalent in modern C or a common compiler (cherry picked from commit f85e117) Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
|
This is a follow-up to #143508. When all the public macros were documented, the section became somewhat unwieldy.
📚 Documentation preview 📚: https://cpython-previews--144471.org.readthedocs.build/