Title: [1.15 regression] (Temporary) false positive for reachability with unannotated partial type · Issue #18606 · python/mypy · GitHub
Open Graph Title: [1.15 regression] (Temporary) false positive for reachability with unannotated partial type · Issue #18606 · python/mypy
X Title: [1.15 regression] (Temporary) false positive for reachability with unannotated partial type · Issue #18606 · python/mypy
Description: Sort of a weird / minor case, but with mypy 1.15 λ cat e.py def merge_debugs(debugs: list[int | None]) -> None: metadata = None for debug in debugs: if debug is not None: if metadata is None: metadata = {} λ mypy e.py --warn-unreachable ...
Open Graph Description: Sort of a weird / minor case, but with mypy 1.15 λ cat e.py def merge_debugs(debugs: list[int | None]) -> None: metadata = None for debug in debugs: if debug is not None: if metadata is None: metad...
X Description: Sort of a weird / minor case, but with mypy 1.15 λ cat e.py def merge_debugs(debugs: list[int | None]) -> None: metadata = None for debug in debugs: if debug is not None: if metadata is None: me...
Opengraph URL: https://github.com/python/mypy/issues/18606
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[1.15 regression] (Temporary) false positive for reachability with unannotated partial type","articleBody":"Sort of a weird / minor case, but with mypy 1.15\n```\nλ cat e.py\ndef merge_debugs(debugs: list[int | None]) -\u003e None:\n metadata = None\n for debug in debugs:\n if debug is not None:\n if metadata is None:\n metadata = {}\n\nλ mypy e.py --warn-unreachable\ne.py:6: error: Need type annotation for \"metadata\" (hint: \"metadata: dict[\u003ctype\u003e, \u003ctype\u003e] = ...\") [var-annotated]\ne.py:6: error: Statement is unreachable [unreachable]\nFound 2 errors in 1 file (checked 1 source file)\n```\nIf you add an annotation to `metadata` (standalone or with the assignment) the unreachable warning goes away","author":{"url":"https://github.com/hauntsaninja","@type":"Person","name":"hauntsaninja"},"datePublished":"2025-02-05T05:30:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/18606/mypy/issues/18606"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3688525e-cae3-87bf-a80a-11fc8b537409 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D322:28C0E5:1A339D8:223E0A4:6A5C7BBF |
| html-safe-nonce | 3b74e8d4428cfb88eaf1ff9e29c1cebd0405af8e133d9b84565e50bf31512898 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzIyOjI4QzBFNToxQTMzOUQ4OjIyM0UwQTQ6NkE1QzdCQkYiLCJ2aXNpdG9yX2lkIjoiNDgyMDE1NDk1ODE0MTQ4ODA2MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 52b181bb0c701c279a6a5222effc373bea13e90fb01af82164dcdb42f5fdedde |
| hovercard-subject-tag | issue:2831945458 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/mypy/18606/issue_layout |
| twitter:image | https://opengraph.githubassets.com/34b26dc001562f9ed2bd0d18e7f99e031b9add9bfd1dfd610846ed1fe3435c6a/python/mypy/issues/18606 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/34b26dc001562f9ed2bd0d18e7f99e031b9add9bfd1dfd610846ed1fe3435c6a/python/mypy/issues/18606 |
| og:image:alt | Sort of a weird / minor case, but with mypy 1.15 λ cat e.py def merge_debugs(debugs: list[int | None]) -> None: metadata = None for debug in debugs: if debug is not None: if metadata is None: metad... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | hauntsaninja |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width