Skip to content

gh-91912: Long object free list for medium value #91938

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

Closed
wants to merge 12 commits into from

Conversation

penguin-wwy
Copy link
Contributor

@penguin-wwy penguin-wwy commented Apr 26, 2022

Copy link
Contributor

@MojoVampire MojoVampire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the process of refactoring, what used to be PyObject_Free calls (matching the PyObject_Malloc calls used to allocate in the first place) became PyObject_Del calls (which pair with PyObject_New, which is not used here). I don't know whether the two happen to be compatible by coincidence, but even if they are, the calls should still pair with the other calls in the family; New with Del, Malloc with Free, while this patch now pairs Malloc with Del.

else
#endif
{
Py_TYPE(op)->tp_free(op);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it should maybe be calling the type's tp_dealloc, not tp_free? Not going to swear to this, but it feels off to me (then again, calling their tp_dealloc could recurse)... Don't take this comment as gospel, I'm probably wrong here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The argument passed in should be long or a subclass of long, continued use of tp_dealloc has a high probability of leading to unlimited recursive calls.

Copy link
Member

@iritkatriel iritkatriel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has merge conflicts now.

@bedevere-bot
Copy link

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@penguin-wwy
Copy link
Contributor Author

@iritkatriel Resolved conflicts with the main branch.
I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@iritkatriel: please review the changes made to this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants