-
-
Notifications
You must be signed in to change notification settings - Fork 33.4k
gh-132657: optimize PySet_Contains for frozensets
#141183
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
Conversation
eendebakpt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Avoid taking critical section if the object is an exact frozenset.