Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
serhiy-storchaka merged 4 commits intopython:mainfromsobolevn:issue-110525
Oct 9, 2023

Conversation

sobolevn
Copy link
Member

@sobolevnsobolevn commentedOct 8, 2023
edited by bedevere-appbot
Loading

@sobolevnsobolevn requested a review froma team as acode ownerOctober 8, 2023 20:33
Copy link
Member

@serhiy-storchakaserhiy-storchaka left a 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.

Copy link
Member

@vstinnervstinner left a 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)
Copy link
Member

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?

Copy link
MemberAuthor

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 :)

@sobolevn
Copy link
MemberAuthor

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 think that this is intentional, because we don't really callPySet_Check, we callset_check intermediate function which changes some behavior compared toPySet_Check. For example, it convertsNone toNULL (so we can test passingNULL easier).

So, I would prefer to keep this naming convention.

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a 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.

sobolevn reacted with thumbs up emoji
@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
Copy link
Contributor

Sorry,@sobolevn and@serhiy-storchaka, I could not cleanly backport this to3.12 due to a conflict.
Please backport usingcherry_picker on command line.

cherry_picker c49edd7d9c5395a6a6696a4846f56bc8b2b22792 3.12

@sobolevn
Copy link
MemberAuthor

sobolevn commentedOct 9, 2023
edited
Loading

Should I do a manual backport?

@serhiy-storchaka
Copy link
Member

It would be nice. Otherwise I will do it.

sobolevn reacted with thumbs up emoji

sobolevn added a commit to sobolevn/cpython that referenced this pull requestOct 9, 2023
…ythonGH-110526).(cherry picked from commitc49edd7)Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
@bedevere-app
Copy link

GH-110547 is a backport of this pull request to the3.12 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.12only security fixes labelOct 9, 2023
Glyphack pushed a commit to Glyphack/cpython that referenced this pull requestSep 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vstinnervstinnervstinner left review comments

@serhiy-storchakaserhiy-storchakaserhiy-storchaka approved these changes

Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@sobolevn@miss-islington@serhiy-storchaka@vstinner

[8]ページ先頭

©2009-2025 Movatter.jp