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-103906: Remove immortal refcounting in compile/marshal.c#103922
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
corona10 commented Apr 27, 2023
@brandtbucher Not sure worth to do it at compile.c as much as an interpreter but it looks possible. |
JelleZijlstra 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.
If you grep for Py_NewRef(Py_Ellipsis) there are a few more in other files, though I doubt it will make a measurable difference in performance.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
iritkatriel commented Apr 27, 2023
I'm a bit concerned that a change like this would make it hard to reverse the decision to make these objects immortal in the future (it is no longer clear where we need a new reference and where we don't). Should we have Py_New_None/Py_New_Elipsis/etc macros instead, so that the code is clear about this? |
corona10 commented Apr 27, 2023
I think that it will be the proper way and easy to track. |
JelleZijlstra commented Apr 27, 2023
I'm not sure that will be workable. Since there is no refcount change, there will be no way to enforce that these macros are used correctly, so we're likely to regress very quickly on correct use of those macros. |
corona10 commented Apr 27, 2023
@vstinner What do you think about this agenda? |
iritkatriel commented Apr 27, 2023
True. We would need a test mode where they are not immortal and the macros actually change the refcount. |
corona10 commented Apr 27, 2023 • 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.
I am not sure that I understand your intention correctly, so do we need to introduce the following configuration things? |
JelleZijlstra commented Apr 27, 2023
Yes, we'd need something like that. We'd have to run at least one buildbot under that configuration mode too. I'm honestly not sure it would be worth introducing that much complexity. |
corona10 commented Apr 27, 2023 • 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.
One of my concerns about adding such a configuration which determining the C API or macro behavior, as @JelleZijlstra commented it should always be run under at least from the build bot with the configuration enabled. Without the integration from the CI level, such configuration is easily broken and can not guarantee to be built successfully at any time. This is one of my lessons from the |
corona10 commented Apr 27, 2023 • 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.
My suggestion: |
iritkatriel commented Apr 27, 2023
We need a decision on whether we want to put some effort into making the move immortality reversible, or not. The technicalities are not very difficult once that decision is made. I'm not sure who should make the call, but it's not me. |
vstinner commented May 4, 2023
The SC approved https://peps.python.org/pep-0683/ Why would be move backward and remove immortal objects? I'm not used to immortal objects, so right now I'm surprised that some objects require Py_NewRef() whereas others don't. It makes the code less regular and so harder to review for me. But I prefer to stay outside this topic and let others review it :-) |
corona10 commented Jun 5, 2023
It looks like #105195 will be merged soon. I merge this PR, please let me know if the PR occurs any problem. |
Uh oh!
There was an error while loading. Please reload this page.