René's URL Explorer Experiment


Title: Narrow literals in the negative case even with custom equality by A5rocks · Pull Request #18574 · python/mypy · GitHub

Open Graph Title: Narrow literals in the negative case even with custom equality by A5rocks · Pull Request #18574 · python/mypy

X Title: Narrow literals in the negative case even with custom equality by A5rocks · Pull Request #18574 · python/mypy

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

Open Graph Description: Fixes #16465 Fixes #18029 Fixes #17229 Generally, people cannot replace a literal's equality. So negative narrowing is still safe. (not the case for enum literals, so those don't get this ...

X Description: Fixes #16465 Fixes #18029 Fixes #17229 Generally, people cannot replace a literal's equality. So negative narrowing is still safe. (not the case for enum literals, so those don't g...

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

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:821f59cc-6938-32d6-4b4c-02a0613f41be
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCBE0:2934DF:281ABBC:392499C:6A58FEE8
html-safe-nonce06ebffb4f4daedd85b0a812765ce72a8ad9722cdd992cd421693cedf2e8f2a5b
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkUwOjI5MzRERjoyODFBQkJDOjM5MjQ5OUM6NkE1OEZFRTgiLCJ2aXNpdG9yX2lkIjoiNzYyODA2OTE5NDYwMTkyMjI4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac6371bc4a9440dd18c777b589c4b67a0b6882cbae0fdada318568d5b0f4c0d4ba
hovercard-subject-tagpull_request:2307988111
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/18574/pull_request_layout
twitter:imagehttps://opengraph.githubassets.com/83124bbcb127ee6f886abf3e360dd66246982c1d7950ecbcbde778ff37a8a9f3/python/mypy/pull/18574
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/83124bbcb127ee6f886abf3e360dd66246982c1d7950ecbcbde778ff37a8a9f3/python/mypy/pull/18574
og:image:altFixes #16465 Fixes #18029 Fixes #17229 Generally, people cannot replace a literal's equality. So negative narrowing is still safe. (not the case for enum literals, so those don't get this ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameA5rocks
hostnamegithub.com
expected-hostnamegithub.com
None5f2a0c7865178af3d91dd9f13b0cdfc3c73a2529c873d2780bb4c01271a57ec6
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
release9842457e8d7e3b2e1635a63af28da35614845510
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/mypy/pull/18574#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F18574
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%2F18574
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/18574
Reloadhttps://github.com/python/mypy/pull/18574
Reloadhttps://github.com/python/mypy/pull/18574
Please reload this pagehttps://github.com/python/mypy/pull/18574
python https://github.com/python
mypyhttps://github.com/python/mypy
Please reload this pagehttps://github.com/python/mypy/pull/18574
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 466 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
A5rockshttps://github.com/A5rocks
python:masterhttps://github.com/python/mypy/tree/master
A5rocks:negative-narrowing-with-custom-eqhttps://github.com/A5rocks/mypy/tree/negative-narrowing-with-custom-eq
Conversationhttps://github.com/python/mypy/pull/18574
Commits3 (3)https://github.com/python/mypy/pull/18574/commits
Checkshttps://github.com/python/mypy/pull/18574/checks
Files changedhttps://github.com/python/mypy/pull/18574/files
Narrow literals in the negative case even with custom equalityhttps://github.com/python/mypy/pull/18574#top
A5rockshttps://github.com/A5rocks
python:masterhttps://github.com/python/mypy/tree/master
A5rocks:negative-narrowing-with-custom-eqhttps://github.com/A5rocks/mypy/tree/negative-narrowing-with-custom-eq
https://github.com/A5rocks
A5rockshttps://github.com/A5rocks
Jan 30, 2025https://github.com/python/mypy/pull/18574#issue-2822096585
Please reload this pagehttps://github.com/python/mypy/pull/18574
#16465https://github.com/python/mypy/issues/16465
#18029https://github.com/python/mypy/issues/18029
#17229https://github.com/python/mypy/issues/17229
Please reload this pagehttps://github.com/python/mypy/pull/18574
https://github.com/A5rocks
Narrow literals in the negative case even with custom equalityhttps://github.com/python/mypy/pull/18574/commits/9cdfb193831dade20c56e29220d78f7dc1d68718
9cdfb19https://github.com/python/mypy/pull/18574/commits/9cdfb193831dade20c56e29220d78f7dc1d68718
https://github.com/A5rocks
A5rockshttps://github.com/A5rocks
Jan 30, 2025 https://github.com/python/mypy/pull/18574#pullrequestreview-2585356275
View reviewed changes https://github.com/python/mypy/pull/18574/files/9cdfb193831dade20c56e29220d78f7dc1d68718
mypy/checker.pyhttps://github.com/python/mypy/pull/18574/files/9cdfb193831dade20c56e29220d78f7dc1d68718#diff-f96a2d6138bc6cdf2a07c4d37f6071cc25c1631afc107e277a28d5b59fc0ef04
A5rockshttps://github.com/A5rocks
Jan 30, 2025https://github.com/python/mypy/pull/18574#discussion_r1936469240
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/mypy/pull/18574
sterliakovhttps://github.com/sterliakov
Mar 31, 2025https://github.com/python/mypy/pull/18574#discussion_r2021412439
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/mypy/pull/18574
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F18574
https://github.com/A5rocks
Merge branch 'master' into negative-narrowing-with-custom-eqhttps://github.com/python/mypy/pull/18574/commits/6a3f38595e2a42924454c6dfccb5c8859ec4b26d
6a3f385https://github.com/python/mypy/pull/18574/commits/6a3f38595e2a42924454c6dfccb5c8859ec4b26d
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F18574
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
Mar 31, 2025 https://github.com/python/mypy/pull/18574#pullrequestreview-2729939175
View reviewed changes https://github.com/python/mypy/pull/18574/files/6a3f38595e2a42924454c6dfccb5c8859ec4b26d
mypy/checker.pyhttps://github.com/python/mypy/pull/18574/files/9cdfb193831dade20c56e29220d78f7dc1d68718#diff-f96a2d6138bc6cdf2a07c4d37f6071cc25c1631afc107e277a28d5b59fc0ef04
sterliakovhttps://github.com/sterliakov
Mar 31, 2025https://github.com/python/mypy/pull/18574#discussion_r2021412439
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/mypy/pull/18574
test-data/unit/check-narrowing.testhttps://github.com/python/mypy/pull/18574/files/6a3f38595e2a42924454c6dfccb5c8859ec4b26d#diff-0413401ad6a91bc5c66579455009ba606ee0ddfb0a78278c9e53618c83b53ed5
sterliakovhttps://github.com/sterliakov
Mar 31, 2025https://github.com/python/mypy/pull/18574#discussion_r2021415117
Please reload this pagehttps://github.com/python/mypy/pull/18574
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/mypy/pull/18574
A5rockshttps://github.com/A5rocks
May 19, 2025https://github.com/python/mypy/pull/18574#discussion_r2095911569
Please reload this pagehttps://github.com/python/mypy/pull/18574
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/mypy/pull/18574
A5rockshttps://github.com/A5rocks
May 22, 2025https://github.com/python/mypy/pull/18574#discussion_r2101612069
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/mypy/pull/18574
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
May 19, 2025https://github.com/python/mypy/pull/18574#issuecomment-2890906007
Please reload this pagehttps://github.com/python/mypy/pull/18574
https://github.com/A5rocks
A5rockshttps://github.com/A5rocks
May 19, 2025https://github.com/python/mypy/pull/18574#issuecomment-2891348578
Please reload this pagehttps://github.com/python/mypy/pull/18574
https://github.com/sterliakov
sterliakovhttps://github.com/sterliakov
May 20, 2025 https://github.com/python/mypy/pull/18574#pullrequestreview-2854299682
View reviewed changes https://github.com/python/mypy/pull/18574/files/6a3f38595e2a42924454c6dfccb5c8859ec4b26d
https://github.com/twavv
twavvhttps://github.com/twavv
Jul 18, 2025https://github.com/python/mypy/pull/18574#issuecomment-3090667287
Please reload this pagehttps://github.com/python/mypy/pull/18574
https://github.com/A5rocks
Merge branch 'master' into negative-narrowing-with-custom-eqhttps://github.com/python/mypy/pull/18574/commits/3c3ea9bbf8ffed5cf704bc40db6d3d68572244c1
3c3ea9bhttps://github.com/python/mypy/pull/18574/commits/3c3ea9bbf8ffed5cf704bc40db6d3d68572244c1
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
Jul 26, 2025https://github.com/python/mypy/pull/18574#issuecomment-3123378584
mypy_primerhttps://github.com/hauntsaninja/mypy_primer
Please reload this pagehttps://github.com/python/mypy/pull/18574
https://github.com/A5rocks
A5rockshttps://github.com/A5rocks
Jan 10, 2026 https://github.com/python/mypy/pull/18574#ref-pullrequest-3769650923
Rework narrowing logic for equality and identity #20492 https://github.com/python/mypy/pull/20492
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
Jan 23, 2026 https://github.com/python/mypy/pull/18574#ref-pullrequest-3848860392
Better narrowing with custom equality #20643 https://github.com/python/mypy/pull/20643
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
#20643 https://github.com/python/mypy/pull/20643
Jan 27, 2026https://github.com/python/mypy/pull/18574#event-22326758763
hauntsaninjahttps://github.com/hauntsaninja
Jan 27, 2026 https://github.com/python/mypy/pull/18574#ref-commit-e64a84b
https://github.com/hauntsaninja
Better narrowing with custom equality (https://github.com/hauntsaninja/mypy/commit/e64a84b118bb338ec6efd428d398e6ebd5b79bfc
python#20643https://github.com/python/mypy/pull/20643
)https://github.com/hauntsaninja/mypy/commit/e64a84b118bb338ec6efd428d398e6ebd5b79bfc
e64a84bhttps://github.com/hauntsaninja/mypy/commit/e64a84b118bb338ec6efd428d398e6ebd5b79bfc
python#20492 (comment)https://github.com/python/mypy/pull/20492#discussion_r2678846727
python#20532https://github.com/python/mypy/issues/20532
python#18029https://github.com/python/mypy/issues/18029
python#17229https://github.com/python/mypy/issues/17229
python#16465https://github.com/python/mypy/issues/16465
python#18574https://github.com/python/mypy/pull/18574
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%2F18574
https://github.com/sterliakov
sterliakov https://github.com/sterliakov
https://github.com/python/mypy/pull/18574/files/6a3f38595e2a42924454c6dfccb5c8859ec4b26d
[1.12, 1.13] Regression in enum narrowing https://github.com/python/mypy/issues/18029
__eq__ methods disable narrowing in the else block https://github.com/python/mypy/issues/17229
Type-narrowing Union with Literal using comparison to Literal variable https://github.com/python/mypy/issues/16465
Please reload this pagehttps://github.com/python/mypy/pull/18574
https://github.com/A5rocks
https://github.com/sterliakov
https://github.com/twavv
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.