René's URL Explorer Experiment


Title: Narrow TypeVar to bounded TypeVar by ikonst · Pull Request #15377 · python/mypy · GitHub

Open Graph Title: Narrow TypeVar to bounded TypeVar by ikonst · Pull Request #15377 · python/mypy

X Title: Narrow TypeVar to bounded TypeVar by ikonst · Pull Request #15377 · python/mypy

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

Open Graph Description: Fixes #15151. When isinstance narrows a TypeVar, it should narrow it to a bounded TypeVar rather than to an Instance, so it could keep functioning as that TypeVar.

X Description: Fixes #15151. When isinstance narrows a TypeVar, it should narrow it to a bounded TypeVar rather than to an Instance, so it could keep functioning as that TypeVar.

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

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
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:c0b9243f-244c-18e4-a3ff-74d3316c67ac
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idCA84:2E9DBB:255324C:3303CF2:6B003C6A
html-safe-nonce00fb4309bcbfe63badb52c241ff2178a9b862bea81256b29909665e17684e2af
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQTg0OjJFOURCQjoyNTUzMjRDOjMzMDNDRjI6NkIwMDNDNkEiLCJ2aXNpdG9yX2lkIjoiNDQyMzk2NDI1MjUyODcyMTAwMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacbfee7c3bc72ad8b11e61de8b8f9163499929a1895e1725e5cbf73d547de15e03
hovercard-subject-tagpull_request:1380081090
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/15377/pull_request_layout
twitter:imagehttps://opengraph.githubassets.com/2257649c1278156c5177b23332a7ae5255db471d668eecfbdf11a388fd3c2f88/python/mypy/pull/15377
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2257649c1278156c5177b23332a7ae5255db471d668eecfbdf11a388fd3c2f88/python/mypy/pull/15377
og:image:altFixes #15151. When isinstance narrows a TypeVar, it should narrow it to a bounded TypeVar rather than to an Instance, so it could keep functioning as that TypeVar.
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameikonst
hostnamegithub.com
expected-hostnamegithub.com
None7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0
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
releasef3f3a43ca095cdea3abbb394112e971f9fdb94fa
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-namepull-requests

Links:

Skip to contenthttps://github.com/python/mypy/pull/15377#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F15377
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F15377
Sign uphttps://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/15377
Reloadhttps://github.com/python/mypy/pull/15377
Reloadhttps://github.com/python/mypy/pull/15377
pythonhttps://github.com/python
mypyhttps://github.com/python/mypy
Codehttps://github.com/python/mypy
Issues2.7k (2.7k)https://github.com/python/mypy/issues
Pull requests545 (545)https://github.com/python/mypy/pulls
Actionshttps://github.com/python/mypy/actions
Projectshttps://github.com/python/mypy/projects
Wikihttps://github.com/python/mypy/wiki
Security and qualityhttps://github.com/python/mypy/security
Insightshttps://github.com/python/mypy/insights
https://github.com/python/mypy
ikonsthttps://github.com/ikonst
python:masterhttps://github.com/python/mypy/tree/master
ikonst:06-05-Narrow_TypeVar_to_bounded_TypeVarhttps://github.com/ikonst/mypy/tree/06-05-Narrow_TypeVar_to_bounded_TypeVar
Conversationhttps://github.com/python/mypy/pull/15377
Commits6 (6)https://github.com/python/mypy/pull/15377/commits
Checkshttps://github.com/python/mypy/pull/15377/checks
Files changedhttps://github.com/python/mypy/pull/15377/files
Narrow TypeVar to bounded TypeVarhttps://github.com/python/mypy/pull/15377#top
ikonsthttps://github.com/ikonst
python:masterhttps://github.com/python/mypy/tree/master
ikonst:06-05-Narrow_TypeVar_to_bounded_TypeVarhttps://github.com/ikonst/mypy/tree/06-05-Narrow_TypeVar_to_bounded_TypeVar
https://github.com/ikonst
ikonsthttps://github.com/ikonst
Jun 6, 2023https://github.com/python/mypy/pull/15377#issue-1742987757
#15151https://github.com/python/mypy/issues/15151
Please reload this pagehttps://github.com/python/mypy/pull/15377
https://github.com/ikonst
Narrow TypeVar to bounded TypeVarhttps://github.com/python/mypy/pull/15377/commits/702310a1aae3bcff244d54e360edc2b39ac8e538
702310ahttps://github.com/python/mypy/pull/15377/commits/702310a1aae3bcff244d54e360edc2b39ac8e538
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F15377
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
Jun 6, 2023https://github.com/python/mypy/pull/15377#issuecomment-1577825052
Please reload this pagehttps://github.com/python/mypy/pull/15377
Please reload this pagehttps://github.com/python/mypy/pull/15377
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
Jun 6, 2023https://github.com/python/mypy/pull/15377#event-9440739965
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
Jun 6, 2023https://github.com/python/mypy/pull/15377#event-9440740244
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F15377
https://github.com/ikonst
extra check for unreachable codehttps://github.com/python/mypy/pull/15377/commits/d1364145656da2a4af66ca202cc4eb1706fb00ca
d136414https://github.com/python/mypy/pull/15377/commits/d1364145656da2a4af66ca202cc4eb1706fb00ca
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
Jun 6, 2023https://github.com/python/mypy/pull/15377#event-9440758964
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
Jun 6, 2023https://github.com/python/mypy/pull/15377#event-9440759434
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F15377
https://github.com/tmke8
tmke8https://github.com/tmke8
Jun 6, 2023https://github.com/python/mypy/pull/15377#issuecomment-1578443610
Please reload this pagehttps://github.com/python/mypy/pull/15377
https://github.com/ikonst
ikonsthttps://github.com/ikonst
Jun 6, 2023https://github.com/python/mypy/pull/15377#issuecomment-1578529627
Please reload this pagehttps://github.com/python/mypy/pull/15377
https://github.com/ikonst
testIsinstanceAndNarrowTypeVariable: stricter checkhttps://github.com/python/mypy/pull/15377/commits/cc3714bc44def9cec7d37764b067ef89ced88563
cc3714bhttps://github.com/python/mypy/pull/15377/commits/cc3714bc44def9cec7d37764b067ef89ced88563
https://github.com/ikonst
ikonsthttps://github.com/ikonst
Jun 6, 2023https://github.com/python/mypy/pull/15377#issuecomment-1578927704
Please reload this pagehttps://github.com/python/mypy/pull/15377
61b71e9https://github.com/python/mypy/commit/61b71e915174402f4ea93c0d418cb6cb927765b9
Please reload this pagehttps://github.com/python/mypy/pull/15377
https://github.com/ikonst
ikonsthttps://github.com/ikonst
Jun 6, 2023https://github.com/python/mypy/pull/15377#issuecomment-1578930661
Please reload this pagehttps://github.com/python/mypy/pull/15377
https://github.com/ikonst
TypeStrVisitor: show narrowed upper boundhttps://github.com/python/mypy/pull/15377/commits/f3edd218275cefc1aea2efde15e14608ce200700
f3edd21https://github.com/python/mypy/pull/15377/commits/f3edd218275cefc1aea2efde15e14608ce200700
https://github.com/ikonst
ikonsthttps://github.com/ikonst
force-pushedhttps://github.com/python/mypy/compare/f195e012d144cc2a88f1b86b0ae786e20ef393f3..61b71e915174402f4ea93c0d418cb6cb927765b9
f195e01https://github.com/python/mypy/commit/f195e012d144cc2a88f1b86b0ae786e20ef393f3
61b71e9https://github.com/python/mypy/commit/61b71e915174402f4ea93c0d418cb6cb927765b9
Compare https://github.com/python/mypy/compare/f195e012d144cc2a88f1b86b0ae786e20ef393f3..61b71e915174402f4ea93c0d418cb6cb927765b9
June 6, 2023 15:04https://github.com/python/mypy/pull/15377#event-9447540270
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F15377
https://github.com/ikonst
add failing testIsinstanceAndNarrowTypeVariableIntersectionhttps://github.com/python/mypy/pull/15377/commits/b84e3f83b7e20713c9dd92a2fb1a303159e81cc4
b84e3f8https://github.com/python/mypy/pull/15377/commits/b84e3f83b7e20713c9dd92a2fb1a303159e81cc4
https://github.com/ikonst
ikonsthttps://github.com/ikonst
force-pushedhttps://github.com/python/mypy/compare/61b71e915174402f4ea93c0d418cb6cb927765b9..b84e3f83b7e20713c9dd92a2fb1a303159e81cc4
61b71e9https://github.com/python/mypy/commit/61b71e915174402f4ea93c0d418cb6cb927765b9
b84e3f8https://github.com/python/mypy/commit/b84e3f83b7e20713c9dd92a2fb1a303159e81cc4
Compare https://github.com/python/mypy/compare/61b71e915174402f4ea93c0d418cb6cb927765b9..b84e3f83b7e20713c9dd92a2fb1a303159e81cc4
June 6, 2023 15:52https://github.com/python/mypy/pull/15377#event-9448079470
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F15377
https://github.com/ikonst
ikonsthttps://github.com/ikonst
Jun 7, 2023https://github.com/python/mypy/pull/15377#issuecomment-1580961279
@JelleZijlstrahttps://github.com/JelleZijlstra
#15151 (comment)https://github.com/python/mypy/issues/15151#issuecomment-1529065328
Please reload this pagehttps://github.com/python/mypy/pull/15377
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/JelleZijlstra
Jun 7, 2023https://github.com/python/mypy/pull/15377#issuecomment-1580966078
Please reload this pagehttps://github.com/python/mypy/pull/15377
https://github.com/ikonst
ikonsthttps://github.com/ikonst
Jun 12, 2023https://github.com/python/mypy/pull/15377#issuecomment-1586387920
@ilevkivskyihttps://github.com/ilevkivskyi
Please reload this pagehttps://github.com/python/mypy/pull/15377
https://github.com/eltoder
eltoderhttps://github.com/eltoder
Jul 19, 2023 https://github.com/python/mypy/pull/15377#ref-pullrequest-1810824767
Narrow TypeVars in the negative case + narrow them through upper bounds #15711 https://github.com/python/mypy/pull/15711
https://github.com/hauntsaninja
Merge branch 'master' into 06-05-Narrow_TypeVar_to_bounded_TypeVarhttps://github.com/python/mypy/pull/15377/commits/4b17500d930c6d1f44b03f9f7927de9bef1739c1
4b17500https://github.com/python/mypy/pull/15377/commits/4b17500d930c6d1f44b03f9f7927de9bef1739c1
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
Jan 4, 2024 https://github.com/python/mypy/pull/15377#ref-issue-2064653665
TypeVar("T") can be anything, unless a type guard hints at something else #16742 https://github.com/python/mypy/issues/16742
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
Jan 4, 2024https://github.com/python/mypy/pull/15377#issuecomment-1876643762
mypy_primerhttps://github.com/hauntsaninja/mypy_primer
Please reload this pagehttps://github.com/python/mypy/pull/15377
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
May 31, 2025https://github.com/python/mypy/pull/15377#issuecomment-2925752648
#19183https://github.com/python/mypy/pull/19183
Please reload this pagehttps://github.com/python/mypy/pull/15377
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
May 31, 2025https://github.com/python/mypy/pull/15377#event-17905067938
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%2F15377
Please reload this pagehttps://github.com/python/mypy/pull/15377
Type narrowing of 'TypeVar' causes '[return-value]' error https://github.com/python/mypy/issues/15151
Please reload this pagehttps://github.com/python/mypy/pull/15377
https://github.com/ikonst
https://github.com/hauntsaninja
https://github.com/tmke8
https://github.com/JelleZijlstra
https://github.com/ilevkivskyi
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.