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-130415: Narrow types to constants in branches involving specialized comparisons with a constant by reidenong · Pull Request #144150 · python/cpython

Conversation

@reidenong

@reidenong reidenong commented Jan 22, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

This uses the new predicate optimizer symbol to narrow types to constants in branches involving comparisons with a constant.

This PR provides the implementation for _COMPARE_OP_INT , _COMPARE_OP_STR, _COMPARE_OP_FLOAT.

  • Issue: Better constant narrowing in the JIT optimizer #130415

Sorry, something went wrong.

Uh oh!

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

All reactions
reidenong added 2 commits January 22, 2026 20:04
@reidenong
Add failing regression tests
de4c33f
@reidenong
Add constant narrowing for _COMPARE_OP_INT
ddd202a
@reidenong
reidenong requested review from Fidget-Spinner, markshannon, savannahostrowski and tomasr8 as code owners January 22, 2026 13:30
@bedevere-app bedevere-app Bot mentioned this pull request Jan 22, 2026
Better constant narrowing in the JIT optimizer #130415
Closed
13 of 17 tasks
@bedevere-app bedevere-app Bot added the awaiting review label Jan 22, 2026
reidenong added 3 commits January 22, 2026 22:24
@reidenong
Refine unit test names
030bc28
@reidenong
Add failing unit tests for float EQ, NE
7a03b22
@reidenong
Add constant narrowing for float EQ, NE
eaf3f23
@reidenong

reidenong commented Jan 22, 2026

Copy link
Copy Markdown
Contributor Author

After discussion with Ken Jin I will be adding implementations for all _COMPARE_OP_* in this PR

All reactions

Sorry, something went wrong.

Uh oh!

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

reidenong added 4 commits January 22, 2026 22:45
@reidenong
Fix whitespace
2b5e3e0
@reidenong
Refine unit tests
57ee7f3
@reidenong
Add failing unit tests for str comparison
b8b217b
@reidenong
Add constant narrowing for str EQ, NE
08c1464
@reidenong reidenong changed the title gh-130415: Narrow types to constants in branches involving comparisons with a constant gh-130415: Narrow types to constants in branches involving specialized comparisons with a constant Jan 22, 2026
Fidget-Spinner
Fidget-Spinner approved these changes Jan 24, 2026
View reviewed changes

@Fidget-Spinner Fidget-Spinner left a comment

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.

Thanks

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels Jan 24, 2026
@Fidget-Spinner Fidget-Spinner added the skip news label Jan 24, 2026
@Fidget-Spinner
Fidget-Spinner merged commit 6d972e0 into python:main Jan 24, 2026
68 of 69 checks passed

Uh oh!

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

@bedevere-app bedevere-app Bot removed the awaiting merge label Jan 24, 2026
thunder-coding pushed a commit to thunder-coding/cpython that referenced this pull request Feb 15, 2026
@reidenong @thunder-coding
pythongh-130415: Narrow types to constants in branches involving spec…
fe0b289
…ialized comparisons with a constant (pythonGH-144150)
@reidenong
reidenong deleted the narrow-types-to-constants-for-int-comparisons branch September 2, 2026 04:20
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

skip news

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

@reidenong @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.