-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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-84436: Add codemod for _PyVarObject_HEAD_IMMORTAL_INIT #103308
gh-84436: Add codemod for _PyVarObject_HEAD_IMMORTAL_INIT #103308
Conversation
I assume someone is going to review each of these to determine whether they're in the right places? (e.g. the public docs should not be using an internal macro) If we really do want to update every single use, well, that's why we have the original macro. We should just change it. My understanding of immortal objects is that we'd carefully opt-in certain types, and not do a global find/replace like this. But possibly the design has changed in a way I haven't kept up with. At the very least, if it belongs in public docs, make it a public macro. And if it applies literally everywhere, just modify the existing macro. |
@@ -0,0 +1,3 @@ | |||
Replace all internal uses of PyVarObject_HEAD_INIT fo | |||
_PyVarObject_HEAD_IMMORTAL_INIT to be able to initialize them as immortal | |||
objects since they live thorughout the entire execution |
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.
Typo
objects since they live thorughout the entire execution | |
objects since they live throughout the entire execution |
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.
Like Steve, I do wonder, why not change the macro instead of 150+ files?
If the macro needs to remain different, could we define the macro different when Py_BUILD_CORE
is set?
@zooba We are opting in all static objects as they live throughout the entire execution of the runtime! |
@zooba @gvanrossum the main goal was to not change the expectations of the public C-API of All that said, the solution of using |
This extends the main PR19474 by running the codemod to replace all internal uses of
PyVarObject_HEAD_INIT
for_PyVarObject_HEAD_IMMORTAL_INIT
to be able to initialize them as immortal instances.The reason this was separated out was to provide a cleaner PR to review the main changes of immortal instances in PR19474. While this one is mostly the codemoded files. Created this as direct feedback from: #19474 (comment)