Title: Bug: false positive with --warn-unreachable · Issue #7214 · python/mypy · GitHub
Open Graph Title: Bug: false positive with --warn-unreachable · Issue #7214 · python/mypy
X Title: Bug: false positive with --warn-unreachable · Issue #7214 · python/mypy
Description: Please provide more information to help us understand the issue: Are you reporting a bug, or opening a feature request? Bug Please insert below the code you are checking with mypy, or a mock-up repro if the source is private. We would ap...
Open Graph Description: Please provide more information to help us understand the issue: Are you reporting a bug, or opening a feature request? Bug Please insert below the code you are checking with mypy, or a mock-up rep...
X Description: Please provide more information to help us understand the issue: Are you reporting a bug, or opening a feature request? Bug Please insert below the code you are checking with mypy, or a mock-up rep...
Opengraph URL: https://github.com/python/mypy/issues/7214
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bug: false positive with --warn-unreachable","articleBody":"Please provide more information to help us understand the issue:\r\n\r\n* Are you reporting a bug, or opening a feature request?\r\nBug\r\n\r\n* Please insert below the code you are checking with mypy,\r\n or a mock-up repro if the source is private. We would appreciate\r\n if you try to simplify your case to a minimal repro.\r\n\r\n```\r\nfrom contextlib import suppress\r\nfrom typing import Dict\r\n\r\n\r\ndef foo(blah: Dict[str, str]):\r\n with suppress(KeyError):\r\n return blah[\"blah\"]\r\n return blah[\"default\"]\r\n\r\n\r\nprint(foo({\"default\": \"default\"}))\r\n```\r\n\r\n* What is the actual behavior/output?\r\n```\r\n$ mypy --warn-unreachable test.py\r\ntest.py:8: error: Statement is unreachable\r\n```\r\n\r\n* What is the behavior/output you expect?\r\nNo error, since line 8 is reachable.\r\n\r\n* What are the versions of mypy and Python you are using?\r\n\r\n```\r\n$ pip freeze | grep mypy\r\nmypy==0.720\r\nmypy-extensions==0.4.1\r\n$ python -V\r\nPython 3.6.8\r\n```\r\n\r\n* What are the mypy flags you are using? (For example --strict-optional)\r\n`--warn-unreachable`\r\n\r\nMaybe related to https://github.com/python/mypy/issues/7204 and https://github.com/python/mypy/issues/7207","author":{"url":"https://github.com/jcugat","@type":"Person","name":"jcugat"},"datePublished":"2019-07-15T07:55:14Z","url":"https://github.com/python/mypy/issues/7214"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:72e26eac-ca13-a341-d914-092573dd52a8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A3AA:D064:2917DEC:37F58D9:6B0048A4 |
| html-safe-nonce | 0ed8a36186fdbb27e2ce4c17f7cbfca60d67c4c459deec8a3954f4c5255060a5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBM0FBOkQwNjQ6MjkxN0RFQzozN0Y1OEQ5OjZCMDA0OEE0IiwidmlzaXRvcl9pZCI6IjU5MTI5MjY5MTg5NTIzNzIzODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 77df70d45047422b5d2a5c2338838965a53f44288c6a09c84027011a09cccd57 |
| hovercard-subject-tag | issue:467987689 |
| 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/7214/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a7ab61a8bf008b0942e00f2a89b9232247b4f52929d5015edfb3d9691490681b/python/mypy/issues/7214 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a7ab61a8bf008b0942e00f2a89b9232247b4f52929d5015edfb3d9691490681b/python/mypy/issues/7214 |
| og:image:alt | Please provide more information to help us understand the issue: Are you reporting a bug, or opening a feature request? Bug Please insert below the code you are checking with mypy, or a mock-up rep... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jcugat |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width