gh-152666: Avoid reference counting of code objects#152955
gh-152666: Avoid reference counting of code objects#152955brijkapadia wants to merge 12 commits into
Conversation
markshannon
left a comment
There was a problem hiding this comment.
The implementation of the old codes list looks good.
I'm wondering if the behavior, not the implementation, could be tested (or is it already?)
Also, can you make f_executable a PyObject * and always borrow it, to minimize overhead?
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Co-authored-by: Mark Shannon <Mark.Shannon@arm.com>
|
I have made the requested changes; please review again Unless I'm missing something (which is possible!) I do not think there is a way for generators to hold borrowed references without changing behavior. |
|
Thanks for making the requested changes! @markshannon: please review the changes made to this pull request. |
The generator is no different to the frame: it can borrow the reference to the code object, as long as it has a strong reference to the function. As the generator needs to keep a reference to the code object when cleared, it must also keep a reference to the function. |
Functions keep a list of past code objects so that a frame only needs borrowed references to them.