Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-95245: Document Py_TPFLAGS_PREHEADER#135861
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
gh-95245: Document Py_TPFLAGS_PREHEADER #135861
Uh oh!
There was an error while loading. Please reload this page.
Conversation
sergey-miryanov commented Jun 23, 2025 • edited by encukou
Loading Uh oh!
There was an error while loading. Please reload this page.
edited by encukou
Uh oh!
There was an error while loading. Please reload this page.
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.
We should include documentation on the type object page too.
sergey-miryanov commented Jun 24, 2025
@ZeroIntensity Thanks for review! Fixed (I hope :) |
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.
I think that if this is internal-only, it would be better to completely drop it from public headers rather than document it as such.
Misc/NEWS.d/next/Core_and_Builtins/2025-06-24-13-08-15.gh-issue-95245.3whjTE.rst Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
ZeroIntensity commented Jun 24, 2025
(Don't do this yet, by the way. Let's come to a consensus in the issue.) |
sergey-miryanov commented Jul 5, 2025
As no comments from @iritkatriel or @markshannon I propose to make it internal as @ZeroIntensity suggested and rename it to @encukou WDYT? |
encukou commented Jul 7, 2025
Per PEP-387, removing (or renaming) it probablyneeds a deprecation cycle. Or is there evidence that no existing code uses it? |
markshannon commented Jul 7, 2025
Since the It might be better to rename it to |
sergey-miryanov commented Jul 7, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
https://grep.app/search?q=Py_TPFLAGS_PREHEADER shows close to nothing of usage. Also, I'm downloading top-pypi packages to checks usage (as described here https://hugovk.dev/blog/2022/how-to-search-5000-python-projects/), will report as it finished. |
sergey-miryanov commented Jul 7, 2025
@markshannon WDYT about wordings in this PR? Can you suggest some improvements? |
sergey-miryanov commented Jul 7, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Searched over 13k+ packages: |
encukou commented Jul 7, 2025
If it's public, it's best not to rename it. |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Petr Viktorin <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
ZeroIntensity commented Jul 7, 2025
I think it's probably safe to rename it, at least for 3.14. Based on a code search, we're the only ones who use it (all the non-CPython mentions are people copying our headers). |
sergey-miryanov commented Jul 7, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Only recordclass uses it - #135861 (comment) |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Peter Bierma <[email protected]>
sergey-miryanov commented Aug 22, 2025
@ZeroIntensity Please take a look. |
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.
Thanks, this mostly looks good.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Peter Bierma <[email protected]>
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.
I'm not a huge fan of documenting things that should be private, but I think it's too late to move this to internal headers or rename it. We should consider deprecating this in 3.15.
@encukou Would you like to finish up your review?
encukou commented Aug 25, 2025
It's hard to deprecate a macro, so adding warnings in docs look best. |
5baa7a0 into python:mainUh oh!
There was an error while loading. Please reload this page.
sergey-miryanov commented Aug 25, 2025
Thanks everyone! |
I see following usages of Py_TPFLAGS_PREHEADER:
I checked all linked PR from #95245 and can't find any explanation. I also checked https://github.com/python/cpython/blob/main/Objects/object_layout.md.
@encukou Please take a look.