GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-148083: Constant-fold _CONTAINS_OP_SET for frozenset by corona10 · Pull Request #148084 · python/cpython

Conversation

@corona10

@corona10 corona10 commented Apr 4, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Issue: Constant-fold _CONTAINS_OP_SET for frozenset in the JIT optimizer #148083

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@corona10
pythongh-148083: Constant-fold _CONTAINS_OP_SET for frozenset
52ca498
@corona10
corona10 requested review from Fidget-Spinner, markshannon, savannahostrowski and tomasr8 as code owners April 4, 2026 12:01
@bedevere-app bedevere-app Bot added the awaiting core review label Apr 4, 2026
@bedevere-app bedevere-app Bot mentioned this pull request Apr 4, 2026
Constant-fold _CONTAINS_OP_SET for frozenset in the JIT optimizer #148083
Closed
@corona10
nit
98b11c4
@corona10

corona10 commented Apr 4, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

AS-IS

['_START_EXECUTOR', '_MAKE_WARM', '_SET_IP', '_CHECK_PERIODIC', '_CHECK_VALIDITY', '_ITER_CHECK_RANGE', '_GUARD_NOT_EXHAUSTED_RANGE', '_ITER_NEXT_RANGE', '_SET_IP', '_SWAP_FAST_2', '_SPILL_OR_RELOAD', '_POP_TOP', '_CHECK_VALIDITY', '_LOAD_CONST_INLINE_BORROW', '_GUARD_GLOBALS_VERSION', '_LOAD_CONST_INLINE', '_SET_IP', '_CONTAINS_OP_SET', '_SPILL_OR_RELOAD', '_POP_TOP', '_POP_TOP_NOP', '_CHECK_VALIDITY', '_GUARD_BIT_IS_SET_POP_5', '_LOAD_FAST_BORROW_1', '_LOAD_CONST_INLINE_BORROW', '_GUARD_NOS_INT', '_BINARY_OP_ADD_INT', '_POP_TOP_NOP', '_POP_TOP_NOP', '_SWAP_FAST_1', '_POP_TOP_INT', '_JUMP_TO_TOP', '_DEOPT', '_ERROR_POP_N', '_DEOPT', '_EXIT_TRACE', '_EXIT_TRACE', '_ERROR_POP_N', '_DEOPT', '_DEOPT', '_ERROR_POP_N', '_DEOPT', '_EXIT_TRACE', '_EXIT_TRACE']

TO-BE

['_START_EXECUTOR', '_MAKE_WARM', '_SET_IP', '_CHECK_PERIODIC', '_CHECK_VALIDITY', '_ITER_CHECK_RANGE', '_GUARD_NOT_EXHAUSTED_RANGE', '_ITER_NEXT_RANGE', '_SET_IP', '_SWAP_FAST_2', '_SPILL_OR_RELOAD', '_POP_TOP', '_CHECK_VALIDITY', '_LOAD_CONST_INLINE_BORROW', '_GUARD_GLOBALS_VERSION', '_LOAD_CONST_INLINE', '_SET_IP', '_INSERT_2_LOAD_CONST_INLINE_BORROW', '_SPILL_OR_RELOAD', '_POP_TOP', '_POP_TOP_NOP', '_CHECK_VALIDITY', '_SET_IP', '_SPILL_OR_RELOAD', '_POP_TOP', '_CHECK_VALIDITY', '_LOAD_FAST_BORROW_1', '_LOAD_CONST_INLINE_BORROW', '_GUARD_NOS_INT', '_BINARY_OP_ADD_INT', '_POP_TOP_NOP', '_POP_TOP_NOP', '_SWAP_FAST_1', '_POP_TOP_INT', '_JUMP_TO_TOP', '_DEOPT', '_ERROR_POP_N', '_DEOPT', '_EXIT_TRACE', '_EXIT_TRACE', '_ERROR_POP_N', '_DEOPT', '_DEOPT', '_DEOPT', '_DEOPT', '_EXIT_TRACE']

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Fidget-Spinner
Fidget-Spinner approved these changes Apr 4, 2026
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Apr 4, 2026
@corona10
corona10 enabled auto-merge (squash) April 4, 2026 12:17
@corona10
corona10 merged commit 289f19a into python:main Apr 4, 2026
74 of 76 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Apr 4, 2026
Fidget-Spinner
Fidget-Spinner reviewed Apr 4, 2026
View reviewed changes
Comment thread Python/optimizer_symbols.c
(typ == &PyBool_Type) ||
(typ == &PyFrozenDict_Type);
(typ == &PyFrozenDict_Type) ||
(typ == &PyFrozenSet_Type);

@Fidget-Spinner Fidget-Spinner Apr 4, 2026

Copy link
Copy Markdown
Member

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.

Ah wait this isnt really safe for the case of frozenset IN frozenset

Basically it's only safe if the LHS is a non-container safe type with pure hash function, and the RHS is frozenset

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Fidget-Spinner Fidget-Spinner Apr 4, 2026

Copy link
Copy Markdown
Member

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.

So you need to add a check that says LHS != Frozenset/FrozenDict type.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@Fidget-Spinner Fidget-Spinner Apr 4, 2026

Copy link
Copy Markdown
Member

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.

Same for frozendict btw.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@corona10 corona10 Apr 4, 2026

Copy link
Copy Markdown
Member Author

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 will send a new PR for this :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pablogsal pablogsal mentioned this pull request Apr 4, 2026
gh-130273: Fix traceback color output with unicode characters #142529
Merged
@Wulian233 Wulian233 mentioned this pull request Apr 14, 2026
gh-131798: Constant-fold _CONTAINS_OP_DICT for frozendict #148548
Merged
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
@corona10 @ljfp
pythongh-148083: Constant-fold _CONTAINS_OP_SET for frozenset (python…
315db30
…gh-148084)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@Fidget-Spinner Fidget-Spinner Fidget-Spinner approved these changes
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner
@tomasr8 tomasr8 Awaiting requested review from tomasr8 tomasr8 is a code owner
@savannahostrowski savannahostrowski Awaiting requested review from savannahostrowski

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@corona10 @Fidget-Spinner
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.