FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-148083: Constant-fold _CONTAINS_OP_SET for frozenset by corona10 · Pull Request #148084 · python/cpython · GitHub

Repository navigation

gh-148083: Constant-fold _CONTAINS_OP_SET for frozenset - #148084

Merged
corona10 merged 2 commits into
python:mainfrom
corona10:gh-148083
Apr 4, 2026
Merged

corona10 merged 2 commits into
python:mainfrom
corona10:gh-148083

Conversation

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

Copy link
Copy Markdown
Member

corona10 commented Apr 4, 2026 •
edited
Loading

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']

corona10 enabled auto-merge (squash) April 4, 2026 12:17
corona10 merged commit 289f19a into python:main Apr 4, 2026
74 of 76 checks passed
(typ == &PyBool_Type) ||
(typ == &PyFrozenDict_Type);
(typ == &PyFrozenDict_Type) ||
(typ == &PyFrozenSet_Type);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Same for frozendict btw.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I will send a new PR for this :)

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL