Skip to content

gh-110525: Cover PySet_Add corner case with frozenset objects #110544

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

Merged
merged 4 commits into from
Oct 9, 2023

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Oct 9, 2023

This corner case cannot be covered from Python code, as far as I can tell. But, it is documented:

   Also works with :class:`frozenset`
   instances (like :c:func:`PyTuple_SetItem` it can be used to fill in the values
   of brand new frozensets before they are exposed to other code).

So, I think we need to test it as well in C code. Sorry for missing this in the original PR!

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

There is a leak of num.

@sobolevn
Copy link
Member Author

sobolevn commented Oct 9, 2023

Thanks for the catch! Fixed.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

Yes, and fs.

@sobolevn
Copy link
Member Author

sobolevn commented Oct 9, 2023

Counting references in your head is exausting!
If only we had better languages for this 🐍 🦀

@serhiy-storchaka
Copy link
Member

Then we probably wouldn't need Python.

@serhiy-storchaka serhiy-storchaka merged commit ea39c87 into python:main Oct 9, 2023
@serhiy-storchaka serhiy-storchaka added the needs backport to 3.12 only security fixes label Oct 9, 2023
@miss-islington
Copy link
Contributor

Thanks @sobolevn for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 9, 2023
…ythonGH-110544)

(cherry picked from commit ea39c87)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
@bedevere-app
Copy link

bedevere-app bot commented Oct 9, 2023

GH-110554 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Oct 9, 2023
serhiy-storchaka pushed a commit that referenced this pull request Oct 9, 2023
…H-110544) (GH-110554)

(cherry picked from commit ea39c87)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
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.

3 participants