Uh oh!
There was an error while loading. Please reload this page.
gh-132657: optimize PySet_Contains for frozensets - #141183
Conversation
Uh oh!
There was an error while loading. Please reload this page.
eendebakpt
left a comment
There was a problem hiding this comment.
Looks good to me. Also see #132290, which also removes locks for set arguments to PySet_Contains.
1e148e1 to
f550bb5CompareCarreau
commented
Nov 7, 2025
Do you want to include a variation of my proposed test in testcapi/set.c ? With the proper Null checks and Pydecref of course. This will avoid regressions. |
kumaraditya303
commented
Nov 11, 2025
Would you like to propose a PR for that? That could be backported as well but since this PR is perf optimization it won't be backported. |
Uh oh!
There was an error while loading. Please reload this page.
As discussed in pythongh-141183, the test suite did not test that PySet_Contains does not convert unhashable key into a frozenset. This commit adds a regression test for this behavior, to ensure that any behavior change is caught by the test suite.
As discussed in pythongh-141183, the test suite did not test that PySet_Contains does not convert unhashable key into a frozenset. This commit adds a regression test for this behavior, to ensure that any behavior change is caught by the test suite.
As discussed in pythongh-141183, the test suite did not test that PySet_Contains does not convert unhashable key into a frozenset. This commit adds a regression test for this behavior, to ensure that any behavior change is caught by the test suite.
Done as #141411 |
As discussed in pythongh-141183, the test suite did not test that PySet_Contains does not convert unhashable key into a frozenset. This commit adds a regression test for this behavior, to ensure that any behavior change is caught by the test suite.
Thanks @kumaraditya303 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
GH-141773 is a backport of this pull request to the 3.14 branch. |
Avoid taking critical section if the object is an exact frozenset.