René's URL Explorer Experiment


Title: [mypy 2.4 regression] Incorrect type narrowing for reversed list of tuples · Issue #22174 · python/mypy · GitHub

Open Graph Title: [mypy 2.4 regression] Incorrect type narrowing for reversed list of tuples · Issue #22174 · python/mypy

X Title: [mypy 2.4 regression] Incorrect type narrowing for reversed list of tuples · Issue #22174 · python/mypy

Description: Bug Report As of mypy 2.4.0, code that iterates over a reversed list of tuples where one of the tuple elements is Any will infer that the type of every tuple element is Any. This is a change in behavior from 2.3.1, which breaks type chec...

Open Graph Description: Bug Report As of mypy 2.4.0, code that iterates over a reversed list of tuples where one of the tuple elements is Any will infer that the type of every tuple element is Any. This is a change in beh...

X Description: Bug Report As of mypy 2.4.0, code that iterates over a reversed list of tuples where one of the tuple elements is Any will infer that the type of every tuple element is Any. This is a change in beh...

Opengraph URL: https://github.com/python/mypy/issues/22174

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[mypy 2.4 regression] Incorrect type narrowing for reversed list of tuples","articleBody":"**Bug Report**\n\nAs of mypy 2.4.0, code that iterates over a reversed list of tuples where one of the tuple elements is Any will infer that the type of every tuple element is Any. This is a change in behavior from 2.3.1, which breaks type checking of existing code.\n\n**To Reproduce**\n\nUse [this Gist](https://mypy-play.net/?mypy=latest&python=3.12&flags=warn-return-any&gist=401cfc26981101164ab98385708ac43f)\n\n**Expected Behavior**\n\nSame as mypy 2.3.1, the type of the second element of the tuple should be `int`:\n```\nmain.py:5: note: Revealed type is \"int\"\nSuccess: no issues found in 1 source file\n```\n\n**Actual Behavior**\n\nOn mypy 2.4.0 the type of the second tuple element is inferred as `Any`:\n```\nmain.py:5: note: Revealed type is \"Any\"\nmain.py:6: error: Returning Any from function declared to return \"int | None\"  [no-any-return]\nFound 1 error in 1 file (checked 1 source file)\n```\n\n**Your Environment**\n\n- Mypy version used: 2.4.0\n- Mypy command-line flags: --warn-return-any\n- Python version used: 3.12","author":{"url":"https://github.com/haudren-woven","@type":"Person","name":"haudren-woven"},"datePublished":"2026-10-07T01:07:51Z","url":"https://github.com/python/mypy/issues/22174"}

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/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:fbd20266-0f73-2a15-6f6f-4c09ff7dce71
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE81C:1EE22E:370EAF:4CBF85:6B005E39
html-safe-nonce5e1d64706a4f72ced3626168377175aaa304c5201b8bf85eeb7c62c5718af920
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODFDOjFFRTIyRTozNzBFQUY6NENCRjg1OjZCMDA1RTM5IiwidmlzaXRvcl9pZCI6Ijg4Nzc2NzM0NjI0Nzk0NzgzMjkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac44ac0926e813a3053a6e44ce1dc2dd6eeff2edc24d55c4e0fefb285f8eea0ddc
hovercard-subject-tagissue:5796259717
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/22174/issue_layout
twitter:imagehttps://opengraph.githubassets.com/da8978f71a7b4523817f8c5bee2df09f420ff658085faba358af03ab5501e5de/python/mypy/issues/22174
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/da8978f71a7b4523817f8c5bee2df09f420ff658085faba358af03ab5501e5de/python/mypy/issues/22174
og:image:altBug Report As of mypy 2.4.0, code that iterates over a reversed list of tuples where one of the tuple elements is Any will infer that the type of every tuple element is Any. This is a change in beh...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamehaudren-woven
hostnamegithub.com
expected-hostnamegithub.com
None29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73
turbo-cache-controlno-preview
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
releaseeacd927ba6112e3b01ba99c762bd699a4a4f5df7
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/22174#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F22174
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%2Fissues%2F22174
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%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fmypy
Reloadhttps://github.com/python/mypy/issues/22174
Reloadhttps://github.com/python/mypy/issues/22174
Reloadhttps://github.com/python/mypy/issues/22174
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
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/22174
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/22174
#22293https://github.com/python/mypy/pull/22293
[mypy 2.4 regression] Incorrect type narrowing for reversed list of tupleshttps://github.com/python/mypy/issues/22174#top
#22293https://github.com/python/mypy/pull/22293
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
topic-overloadshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-overloads%22
https://github.com/haudren-woven
haudren-wovenhttps://github.com/haudren-woven
on Oct 7, 2026https://github.com/python/mypy/issues/22174#issue-5796259717
this Gisthttps://mypy-play.net/?mypy=latest&python=3.12&flags=warn-return-any&gist=401cfc26981101164ab98385708ac43f
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on Oct 7, 2026https://github.com/python/mypy/issues/22174#issuecomment-6103359150
#21799https://github.com/python/mypy/pull/21799
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on Oct 7, 2026https://github.com/python/mypy/issues/22174#issuecomment-6103359221
python/typeshed#11646https://github.com/python/typeshed/pull/11646
hauntsaninjahttps://github.com/hauntsaninja
on Oct 7, 2026https://github.com/python/mypy/issues/22174#event-32962910920
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Oct 7, 2026https://github.com/python/mypy/issues/22174#issuecomment-6103359266
@hauntsaninjahttps://github.com/hauntsaninja
Kamilbenkiranehttps://github.com/Kamilbenkirane
on Oct 7, 2026https://github.com/python/mypy/issues/22174#event-32962911038
chore(deps): pin mypy below 2.4 (#494)https://github.com/withceleste/celeste-python/commit/0cdce35e59f6ae94e16c115e20fe3a1eab1c7fdb
#494https://github.com/withceleste/celeste-python/pull/494
0cdce35https://github.com/withceleste/celeste-python/commit/0cdce35e59f6ae94e16c115e20fe3a1eab1c7fdb
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Oct 10, 2026https://github.com/python/mypy/issues/22174#issuecomment-6103359299
ilevkivskyihttps://github.com/ilevkivskyi
python/mypyhttps://github.com/python/mypy
on Oct 10, 2026https://github.com/python/mypy/issues/22174#event-32962911338
AlexWaygoodhttps://github.com/AlexWaygood
on Oct 10, 2026https://github.com/python/mypy/issues/22174#event-32962911367
https://github.com/srittau
srittauhttps://github.com/srittau
on Oct 10, 2026https://github.com/python/mypy/issues/22174#issuecomment-6103359340
https://mypy-play.net/?mypy=2.4.0&python=3.12&flags=warn-return-any&gist=fe5b3b103252c7abc7a9dc3b9d3d0354https://mypy-play.net/?mypy=2.4.0&python=3.12&flags=warn-return-any&gist=fe5b3b103252c7abc7a9dc3b9d3d0354
https://github.com/python/typeshed/blob/0d9b1926fc75ea33c643171b83cea73e3dd9990c/stdlib/builtins.pyi#L2209-L2218https://github.com/python/typeshed/blob/0d9b1926fc75ea33c643171b83cea73e3dd9990c/stdlib/builtins.pyi#L2209-L2218
https://github.com/python/typeshed/blob/0d9b1926fc75ea33c643171b83cea73e3dd9990c/stdlib/builtins.pyi#L1285https://github.com/python/typeshed/blob/0d9b1926fc75ea33c643171b83cea73e3dd9990c/stdlib/builtins.pyi#L1285
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Oct 10, 2026https://github.com/python/mypy/issues/22174#issuecomment-6103359390
https://typing.python.org/en/latest/spec/overload.html#step-5https://typing.python.org/en/latest/spec/overload.html#step-5
assignablehttps://typing.python.org/en/latest/spec/glossary.html#term-assignable
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Oct 10, 2026https://github.com/python/mypy/issues/22174#issuecomment-6103359423
ilevkivskyihttps://github.com/ilevkivskyi
python/typeshedhttps://github.com/python/typeshed
on Oct 10, 2026https://github.com/python/mypy/issues/22174#event-32962952678
ilevkivskyihttps://github.com/ilevkivskyi
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
topic-overloadshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-overloads%22
on Oct 10, 2026https://github.com/python/mypy/issues/22174#event-32963017608
https://github.com/tevinch
tevinchhttps://github.com/tevinch
on Oct 11, 2026https://github.com/python/mypy/issues/22174#issuecomment-6109745019
Complete runnable example and type/runtime checkshttps://github.com/tevinch/data-shape-kit/tree/main/examples/typed-reverse
subotachttps://github.com/subotac
on Oct 14, 2026https://github.com/python/mypy/issues/22174#event-33226835374
Preserve overload inference when nested Any does not cause ambiguityhttps://github.com/subotac/mypy/commit/120a774092652e39645fe84594c12dc8dac331b2
https://docs.github.com/articles/closing-issues-via-commit-messages
120a774https://github.com/subotac/mypy/commit/120a774092652e39645fe84594c12dc8dac331b2
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/22174
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/22174
bugmypy got something wronghttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22bug%22
topic-overloadshttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22topic-overloads%22
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.