Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
gh-110525: Add CAPI tests forset
andfrozenset
objects#110526
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
Nice.
Please test also with non-hashable items, non-set as the first argument, NULLs for any argument. If some call crashes, add a comment.
Uh oh!
There was an error while loading.Please reload this page.
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.
I was never comfortable with _testcapi having fun with changing C API names. We cannot simply use PySet_New() name in _testcapi and in the test? I would make it more obvious that the test is on... PySet_New().
class TestSetCAPI(unittest.TestCase): | ||
def assertImmutable(self, action, *args): | ||
self.assertRaises(SystemError, action, frozenset(), *args) |
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.
SystemError? That's a surprising error. Usually, it's used when the C API is misused, like passing NULL or the wrong type. frozenset is a "wrong type" here?
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.
Yes, immutable frozenset is a wrong type for mutation-based functions :)
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
I think that this is intentional, because we don't really call So, I would prefer to keep this naming convention. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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.
LGTM. Thank you@sobolevn for your PR.
Thanks@sobolevn for the PR, and@serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
Sorry,@sobolevn and@serhiy-storchaka, I could not cleanly backport this to
|
sobolevn commentedOct 9, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Should I do a manual backport? |
It would be nice. Otherwise I will do it. |
…ythonGH-110526).(cherry picked from commitc49edd7)Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
GH-110547 is a backport of this pull request to the3.12 branch. |
Uh oh!
There was an error while loading.Please reload this page.
Heavily inspired byhttps://github.com/python/cpython/blob/main/Modules/_testcapi/dict.c
set
andfrozenset
#110525