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-131798: JIT: Narrow the return type of_CONTAINS_OP_SET to bool#132057

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

Conversation

tomasr8
Copy link
Member

@tomasr8tomasr8 commentedApr 3, 2025
edited by bedevere-appbot
Loading

For context:#130415 (comment)

I did runmake regen-cases and made sure that the test failed before making the change inoptimizer_bytecodes.c :)

instruction after _CONTAINS_OP_SET by settingthe return type to bool.
Comment on lines +1616 to +1622
x = 0
s = {1, 2, 3}
for _ in range(n):
a = 2
in_set = a in s
if in_set:
x += 1
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We might be able to simplify this further, I wasn't sure how much the peepholer would optimize out if I used e.g.2 in s directly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

2 in s would have been fine, but this works well too!

tomasr8 reacted with thumbs up emoji
@brandtbucherbrandtbucher self-assigned thisApr 4, 2025
@brandtbucherbrandtbucher merged commit85bc489 intopython:mainApr 5, 2025
62 checks passed
@tomasr8tomasr8 deleted the jit-contains-op-set-narrow branchApril 6, 2025 06:11
seehwan pushed a commit to seehwan/cpython that referenced this pull requestApr 16, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@Fidget-SpinnerFidget-SpinnerFidget-Spinner approved these changes

@brandtbucherbrandtbucherbrandtbucher approved these changes

Assignees

@brandtbucherbrandtbucher

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@tomasr8@Fidget-Spinner@brandtbucher

[8]ページ先頭

©2009-2025 Movatter.jp