gh-132657: optimize PySet_Contains for frozensets#141183
gh-132657: optimize PySet_Contains for frozensets#141183kumaraditya303 merged 2 commits intopython:mainfrom
PySet_Contains for frozensets#141183Conversation
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
f550bb5
Compare
|
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. |
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. |
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.