René's URL Explorer Experiment


Title: Better support for `SomeEnum.item == some_literal` by sterliakov · Pull Request #19594 · python/mypy · GitHub

Open Graph Title: Better support for `SomeEnum.item == some_literal` by sterliakov · Pull Request #19594 · python/mypy

X Title: Better support for `SomeEnum.item == some_literal` by sterliakov · Pull Request #19594 · python/mypy

Description: Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub.

Open Graph Description: Fixes #19576. Fixes #16327. Fixes #17162. Fixes #19753. This needs more feedback: is the logic I propose reasonable? Do we want to be stricter and reject such comparisons altogether? Or maybe only ...

X Description: Fixes #19576. Fixes #16327. Fixes #17162. Fixes #19753. This needs more feedback: is the logic I propose reasonable? Do we want to be stricter and reject such comparisons altogether? Or maybe only ...

Opengraph URL: https://github.com/python/mypy/pull/19594

X: @github

direct link

Domain: github.com

route-pattern/_view_fragments/voltron/pull_requests/show/:user_id/:repository/:id/pull_request_layout(.:format)
route-controllervoltron_pull_requests_fragments
route-actionpull_request_layout
fetch-noncev2:bae397e4-5757-3374-e05b-f81fa93426f5
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idB1A4:3847EE:6370D9:8F4270:6A578000
html-safe-nonce3cb149bc1c035ac2d941a65e20649458135e9628edd6ed192b9910fa182d9d1e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMUE0OjM4NDdFRTo2MzcwRDk6OEY0MjcwOjZBNTc4MDAwIiwidmlzaXRvcl9pZCI6IjE2NTc3NzYzOTY0MzE3NTMyMTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac7e6d66f8d37ec38f8b953ed1d56aca2aeaf9de0863c1ff85e4f2ca0a9896c792
hovercard-subject-tagpull_request:2719460978
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/pull_requests_fragments/pull_request_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/voltron/pull_requests/show/python/mypy/19594/pull_request_layout
twitter:imagehttps://opengraph.githubassets.com/ad9f55a10e17d8035bab0d3ae375c5411ca8731e2b4f2e5974a0d0d362965af0/python/mypy/pull/19594
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/ad9f55a10e17d8035bab0d3ae375c5411ca8731e2b4f2e5974a0d0d362965af0/python/mypy/pull/19594
og:image:altFixes #19576. Fixes #16327. Fixes #17162. Fixes #19753. This needs more feedback: is the logic I propose reasonable? Do we want to be stricter and reject such comparisons altogether? Or maybe only ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesterliakov
hostnamegithub.com
expected-hostnamegithub.com
Nonec6353e56e94423c9cd5abde7708a859afa36a0c1203c73749055bf6ee6704cd0
turbo-cache-controlno-cache
go-importgithub.com/python/mypy git https://github.com/python/mypy.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id7053637
octolytics-dimension-repository_nwopython/mypy
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7053637
octolytics-dimension-repository_network_root_nwopython/mypy
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9a9dfe2eff5c790a030f34cfcc89b4bf3ba08c7c
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/mypy/pull/19594#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F19594
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F19594
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fpull_requests_fragments%2Fpull_request_layout&source=header-repo&source_repo=python%2Fmypy
Reloadhttps://github.com/python/mypy/pull/19594
Reloadhttps://github.com/python/mypy/pull/19594
Reloadhttps://github.com/python/mypy/pull/19594
Please reload this pagehttps://github.com/python/mypy/pull/19594
python https://github.com/python
mypyhttps://github.com/python/mypy
Please reload this pagehttps://github.com/python/mypy/pull/19594
Notifications https://github.com/login?return_to=%2Fpython%2Fmypy
Fork 3.2k https://github.com/login?return_to=%2Fpython%2Fmypy
Star 20.5k https://github.com/login?return_to=%2Fpython%2Fmypy
Code https://github.com/python/mypy
Issues 2.7k https://github.com/python/mypy/issues
Pull requests 463 https://github.com/python/mypy/pulls
Actions https://github.com/python/mypy/actions
Projects https://github.com/python/mypy/projects
Wiki https://github.com/python/mypy/wiki
Security and quality 0 https://github.com/python/mypy/security
Insights https://github.com/python/mypy/pulse
Code https://github.com/python/mypy
Issues https://github.com/python/mypy/issues
Pull requests https://github.com/python/mypy/pulls
Actions https://github.com/python/mypy/actions
Projects https://github.com/python/mypy/projects
Wiki https://github.com/python/mypy/wiki
Security and quality https://github.com/python/mypy/security
Insights https://github.com/python/mypy/pulse
sterliakovhttps://github.com/sterliakov
python:masterhttps://github.com/python/mypy/tree/master
sterliakov:bugfix/gh-19576-enum-comparison-overlaphttps://github.com/sterliakov/mypy/tree/bugfix/gh-19576-enum-comparison-overlap
Conversationhttps://github.com/python/mypy/pull/19594
Commits13 (13)https://github.com/python/mypy/pull/19594/commits
Checkshttps://github.com/python/mypy/pull/19594/checks
Files changedhttps://github.com/python/mypy/pull/19594/files
Better support for SomeEnum.item == some_literalhttps://github.com/python/mypy/pull/19594#top
sterliakovhttps://github.com/sterliakov
python:masterhttps://github.com/python/mypy/tree/master
sterliakov:bugfix/gh-19576-enum-comparison-overlaphttps://github.com/sterliakov/mypy/tree/bugfix/gh-19576-enum-comparison-overlap
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
Aug 4, 2025https://github.com/python/mypy/pull/19594#issue-3291097255
Please reload this pagehttps://github.com/python/mypy/pull/19594
#19576https://github.com/python/mypy/issues/19576
#16327https://github.com/python/mypy/issues/16327
#17162https://github.com/python/mypy/issues/17162
#19753https://github.com/python/mypy/issues/19753
Please reload this pagehttps://github.com/python/mypy/pull/19594
https://github.com/sterliakov
Fix enum comparison with literal valueshttps://github.com/python/mypy/pull/19594/commits/ab3ed33b65f53786d214be34d147a60edaf1b887
ab3ed33https://github.com/python/mypy/pull/19594/commits/ab3ed33b65f53786d214be34d147a60edaf1b887
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
Aug 5, 2025 https://github.com/python/mypy/pull/19594#ref-issue-3291106281
Check #19594 sterliakov/mypy-issues#130 https://github.com/sterliakov/mypy-issues/issues/130
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F19594
https://github.com/A5rocks
A5rockshttps://github.com/A5rocks
Aug 5, 2025 https://github.com/python/mypy/pull/19594#pullrequestreview-3086133558
View reviewed changes https://github.com/python/mypy/pull/19594/files/ab3ed33b65f53786d214be34d147a60edaf1b887
A5rockshttps://github.com/A5rocks
https://github.com/python/mypy/pull/19594#pullrequestreview-3086133558
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/mypy/pull/19594
test-data/unit/check-enum.testhttps://github.com/python/mypy/pull/19594/files/ab3ed33b65f53786d214be34d147a60edaf1b887#diff-ebc735ad8fa6eb42d5390fa4fa9ef60581764c7bbfb5eafcde16f5e40c330c84
Please reload this pagehttps://github.com/python/mypy/pull/19594
sterliakovhttps://github.com/sterliakov
August 7, 2025 17:35https://github.com/python/mypy/pull/19594#commits-pushed-6f4dbb8
https://github.com/sterliakov
Merge remote-tracking branch 'upstream/master' into bugfix/https://github.com/python/mypy/pull/19594/commits/6f4dbb8163a218b9f2d6eaa78aa379e302270819
pythongh-1…https://github.com/python/mypy/issues/19576
6f4dbb8https://github.com/python/mypy/pull/19594/commits/6f4dbb8163a218b9f2d6eaa78aa379e302270819
…9576https://github.com/python/mypy/issues/19576
https://github.com/sterliakov
Sync reachability and comparison overlap checkshttps://github.com/python/mypy/pull/19594/commits/350aa53ed54d7dd3668b44487a18dff217016cf9
350aa53https://github.com/python/mypy/pull/19594/commits/350aa53ed54d7dd3668b44487a18dff217016cf9
https://github.com/sterliakov
Fix selfcheckhttps://github.com/python/mypy/pull/19594/commits/ebfc647bcbd243d191f71cfdef0cba6a1a73ce41
ebfc647https://github.com/python/mypy/pull/19594/commits/ebfc647bcbd243d191f71cfdef0cba6a1a73ce41
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F19594
https://github.com/sterliakov
Oopshttps://github.com/python/mypy/pull/19594/commits/0001936504a9c65ba509156bd6b06b4024548f18
0001936https://github.com/python/mypy/pull/19594/commits/0001936504a9c65ba509156bd6b06b4024548f18
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F19594
https://github.com/sterliakov
Prevent narrowing by equality to overlapping literals (discarding enu…https://github.com/python/mypy/pull/19594/commits/c87c7074149944b7578f391f6bb3a2de270026fa
c87c707https://github.com/python/mypy/pull/19594/commits/c87c7074149944b7578f391f6bb3a2de270026fa
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F19594
sterliakovhttps://github.com/sterliakov
August 28, 2025 13:30https://github.com/python/mypy/pull/19594#commits-pushed-ba560f2
https://github.com/sterliakov
No, that was too muchhttps://github.com/python/mypy/pull/19594/commits/ba560f23ed0379aad24a8718ea4c4d335782adec
ba560f2https://github.com/python/mypy/pull/19594/commits/ba560f23ed0379aad24a8718ea4c4d335782adec
https://github.com/sterliakov
Pick unreachable branches more aggressivelyhttps://github.com/python/mypy/pull/19594/commits/d96243d4c96096fd8efcc994c43cbb63366bc079
d96243dhttps://github.com/python/mypy/pull/19594/commits/d96243d4c96096fd8efcc994c43cbb63366bc079
https://github.com/sterliakov
Merge remote-tracking branch 'upstream/master' into bugfix/https://github.com/python/mypy/pull/19594/commits/6c4f0aa207266ca5d1bc9139dbf34cd1963ef201
pythongh-1…https://github.com/python/mypy/issues/19576
6c4f0aahttps://github.com/python/mypy/pull/19594/commits/6c4f0aa207266ca5d1bc9139dbf34cd1963ef201
…9576https://github.com/python/mypy/issues/19576
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F19594
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
August 28, 2025 13:51https://github.com/python/mypy/pull/19594#event-19392353675
https://github.com/A5rocks
A5rockshttps://github.com/A5rocks
Aug 28, 2025 https://github.com/python/mypy/pull/19594#ref-issue-3363703612
Type narrowing an enum shouldn't narrow to a literal #19753 https://github.com/python/mypy/issues/19753
https://github.com/A5rocks
A5rockshttps://github.com/A5rocks
Aug 28, 2025 https://github.com/python/mypy/pull/19594#pullrequestreview-3165331086
View reviewed changes https://github.com/python/mypy/pull/19594/files/6c4f0aa207266ca5d1bc9139dbf34cd1963ef201
A5rockshttps://github.com/A5rocks
https://github.com/python/mypy/pull/19594#pullrequestreview-3165331086
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
#19753https://github.com/python/mypy/issues/19753
Please reload this pagehttps://github.com/python/mypy/pull/19594
https://github.com/sterliakov
Handle (str, Enum) and (int, Enum) subclasses narrowinghttps://github.com/python/mypy/pull/19594/commits/79262e75facbec39b5c7c426ef20b54dce72bfa4
79262e7https://github.com/python/mypy/pull/19594/commits/79262e75facbec39b5c7c426ef20b54dce72bfa4
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F19594
https://github.com/sterliakov
Merge branch 'master' into bugfix/https://github.com/python/mypy/pull/19594/commits/9fda66ecb0734feaf551ed2d6941a33715ee26c0
pythongh-19576https://github.com/python/mypy/issues/19576
-enum-comparison-overlaphttps://github.com/python/mypy/pull/19594/commits/9fda66ecb0734feaf551ed2d6941a33715ee26c0
9fda66ehttps://github.com/python/mypy/pull/19594/commits/9fda66ecb0734feaf551ed2d6941a33715ee26c0
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
topic-enum https://github.com/python/mypy/issues?q=state%3Aopen%20label%3Atopic-enum
Sep 16, 2025https://github.com/python/mypy/pull/19594#event-19723049732
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F19594
https://github.com/sterliakov
Merge branch 'master' into bugfix/https://github.com/python/mypy/pull/19594/commits/b3713a27fd3ab9e2c3a78f3e7afdae8c9296143b
pythongh-19576https://github.com/python/mypy/issues/19576
-enum-comparison-overlaphttps://github.com/python/mypy/pull/19594/commits/b3713a27fd3ab9e2c3a78f3e7afdae8c9296143b
b3713a2https://github.com/python/mypy/pull/19594/commits/b3713a27fd3ab9e2c3a78f3e7afdae8c9296143b
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F19594
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
Oct 30, 2025 https://github.com/python/mypy/pull/19594#ref-issue-3567511411
match-case does not work correctly with Literals vs Enums #20142 https://github.com/python/mypy/issues/20142
https://github.com/sterliakov
Merge branch 'master' into bugfix/https://github.com/python/mypy/pull/19594/commits/00179434dfde0e60c6ea08f3f858cc0d64634af7
pythongh-19576https://github.com/python/mypy/issues/19576
-enum-comparison-overlaphttps://github.com/python/mypy/pull/19594/commits/00179434dfde0e60c6ea08f3f858cc0d64634af7
0017943https://github.com/python/mypy/pull/19594/commits/00179434dfde0e60c6ea08f3f858cc0d64634af7
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
Oct 30, 2025https://github.com/python/mypy/pull/19594#issuecomment-3467866102
mypy_primerhttps://github.com/hauntsaninja/mypy_primer
Please reload this pagehttps://github.com/python/mypy/pull/19594
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
Oct 30, 2025https://github.com/python/mypy/pull/19594#issuecomment-3467911574
#20142 (comment)https://github.com/python/mypy/issues/20142#issuecomment-3467833150
Please reload this pagehttps://github.com/python/mypy/pull/19594
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
October 30, 2025 13:09https://github.com/python/mypy/pull/19594#event-20608759151
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
Oct 30, 2025 https://github.com/python/mypy/pull/19594#ref-pullrequest-3570997746
Do not treat match value patterns as isinstance checks #20146 https://github.com/python/mypy/pull/20146
https://github.com/A5rocks
A5rockshttps://github.com/A5rocks
Feb 15, 2026https://github.com/python/mypy/pull/19594#issuecomment-3905459741
Please reload this pagehttps://github.com/python/mypy/pull/19594
https://github.co/hiddenchars
https://github.com/python/mypy/pull/{{ revealButtonHref }}
Sign up for freehttps://github.com/join?source=comment-repo
Sign in to commenthttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F19594
https://github.com/A5rocks
A5rocks https://github.com/A5rocks
https://github.com/python/mypy/pull/19594/files/6c4f0aa207266ca5d1bc9139dbf34cd1963ef201
topic-enum https://github.com/python/mypy/issues?q=state%3Aopen%20label%3Atopic-enum
comparison-overlap triggers for string enum members when the member name isn't the same as the comparison value https://github.com/python/mypy/issues/19576
IntEnum literals are not considerable comparable with ints https://github.com/python/mypy/issues/16327
Type narrowing an enum shouldn't narrow to a literal https://github.com/python/mypy/issues/19753
False-positive typecheck with StrEnum https://github.com/python/mypy/issues/17162
Please reload this pagehttps://github.com/python/mypy/pull/19594
https://github.com/sterliakov
https://github.com/A5rocks
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.