Sorry, something went wrong.
|
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. |
Sorry, something went wrong.
| @@ -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.
Typo
| objects since they live thorughout the entire execution | |
| objects since they live throughout the entire execution |
Sorry, something went wrong.
There was a problem hiding this comment.
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?
Sorry, something went wrong.
|
carefully opt-in certain types, and not do a global find/replace like this @zooba We are opting in all static objects as they live throughout the entire execution of the runtime! |
Sorry, something went wrong.
|
Like Steve, I do wonder, why not change the macro instead of 150+ files? @zooba @gvanrossum the main goal was to not change the expectations of the public C-API of PyObject_HEAD_INIT and PyVarObject_HEAD_INIT. I think that it should use the immortal value by default but given that this is a public C-API, the goal was to minimize the number of 'disruptive' changes (though it should still be compatible backwards compatible). All that said, the solution of using Py_BUILD_CORE works really nicely so I'll incorporate that in the main PR and close this PR. Whether we change the default to be immortal or not, I'll leave that to a future discussion (unless anyone has strong opinions otherwise 🙂 ) |
Sorry, something went wrong.
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)