Title: (🐞) Inconsistent reachability depending if module level or not · Issue #12409 · python/mypy · GitHub
Open Graph Title: (🐞) Inconsistent reachability depending if module level or not · Issue #12409 · python/mypy
X Title: (🐞) Inconsistent reachability depending if module level or not · Issue #12409 · python/mypy
Description: Really strange behavior here, when this statement is on the module level it creates a silently unreachable branch, but when in a scope it doesn't create unreachable import sys def foo() -> None: assert sys.platform == "AMONGUS" a # error...
Open Graph Description: Really strange behavior here, when this statement is on the module level it creates a silently unreachable branch, but when in a scope it doesn't create unreachable import sys def foo() -> None: as...
X Description: Really strange behavior here, when this statement is on the module level it creates a silently unreachable branch, but when in a scope it doesn't create unreachable import sys def foo() -> N...
Opengraph URL: https://github.com/python/mypy/issues/12409
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"(🐞) Inconsistent reachability depending if module level or not","articleBody":"Really strange behavior here, when this statement is on the module level it creates a silently unreachable branch, but when in a scope it doesn't create unreachable\r\n```py\r\nimport sys\r\n\r\n\r\ndef foo() -> None:\r\n assert sys.platform == \"AMONGUS\"\r\n a # error, reachable ❌\r\n\r\ncond: bool\r\nif cond:\r\n assert sys.platform == \"AMONGUS\"\r\n a # error, reachable ❌\r\n\r\nassert sys.platform == \"AMONGUS\"\r\na # no error, silent unreachable ✅\r\n```\r\n[playground](https://mypy-play.net/?mypy=latest&python=3.10&flags=strict%2Cwarn-unreachable&gist=fe8d3a30736eaca8633a89c9197da603)\r\n\r\n\r\nRelated #11438\r\nRelated #11361","author":{"url":"https://github.com/KotlinIsland","@type":"Person","name":"KotlinIsland"},"datePublished":"2022-03-21T11:38:36Z","url":"https://github.com/python/mypy/issues/12409"}
| 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:8a402f03-6bf7-ae88-421d-49475dab15e4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E2BA:1334EF:307D87:3EA1F9:6AFFC716 |
| html-safe-nonce | c0343df0e2854cdba225faec37bbfd9c0ab870a10c690b903a88bd6463cf7bd1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMkJBOjEzMzRFRjozMDdEODc6M0VBMUY5OjZBRkZDNzE2IiwidmlzaXRvcl9pZCI6IjkxMTE2NTg0MDE2ODI2NzEzODIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | ce7e7ea03082d990435e0c878687227ba98dce227e25a693f091ad6afddf81b3 |
| hovercard-subject-tag | issue:1175258806 |
| 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/12409/issue_layout |
| twitter:image | https://opengraph.githubassets.com/499440b3f5ae1ac43b4ba757f6e37317f628d1890e86d6138013414b5eb48e8c/python/mypy/issues/12409 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/499440b3f5ae1ac43b4ba757f6e37317f628d1890e86d6138013414b5eb48e8c/python/mypy/issues/12409 |
| og:image:alt | Really strange behavior here, when this statement is on the module level it creates a silently unreachable branch, but when in a scope it doesn't create unreachable import sys def foo() -> None: as... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | KotlinIsland |
| hostname | github.com |
| expected-hostname | github.com |
| None | 1e805b832df235bb21305db712c3b6432920019dfc12cb25b9cb8d3b0c9403cf |
| 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 | 8fa4a54e6871c7908eda1c246ad5972982c0b59d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width