Title: Detect impossible condition caused by user defined __bool__ · Issue #7008 · python/mypy · GitHub
Open Graph Title: Detect impossible condition caused by user defined __bool__ · Issue #7008 · python/mypy
X Title: Detect impossible condition caused by user defined __bool__ · Issue #7008 · python/mypy
Description: Eg with the following: from typing import * class Foo: def __bool__(self) -> Literal[True]: return True def some_foo() -> Foo: ... def throw_error(): raise Exception if __name__ == '__main__': print(some_foo() or throw_error()) # ^^^^^^^...
Open Graph Description: Eg with the following: from typing import * class Foo: def __bool__(self) -> Literal[True]: return True def some_foo() -> Foo: ... def throw_error(): raise Exception if __name__ == '__main__': prin...
X Description: Eg with the following: from typing import * class Foo: def __bool__(self) -> Literal[True]: return True def some_foo() -> Foo: ... def throw_error(): raise Exception if __name__ == '__mai...
Opengraph URL: https://github.com/python/mypy/issues/7008
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Detect impossible condition caused by user defined __bool__","articleBody":"Eg with the following:\r\n\r\n```python\r\nfrom typing import *\r\n\r\nclass Foo:\r\n def __bool__(self) -> Literal[True]:\r\n return True\r\n\r\ndef some_foo() -> Foo:\r\n ...\r\n\r\ndef throw_error():\r\n raise Exception\r\n\r\n\r\nif __name__ == '__main__':\r\n print(some_foo() or throw_error())\r\n # ^^^^^^^^^^^^^ impossible condition, unreachable\r\n```\r\n\r\nmypy should be able to detect that the call to throw_error is unreachable","author":{"url":"https://github.com/graingert","@type":"Person","name":"graingert"},"datePublished":"2019-06-17T16:40:00Z","url":"https://github.com/python/mypy/issues/7008"}
| 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:997fbdad-9263-5246-d236-94050f93a2f2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B356:142ADF:CDD79A:10A2C51:6AFFF30F |
| html-safe-nonce | d6c918fd5739676f35bc9d09de8e5baf6035551cd2425269c0d0e50250a8e7d4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzU2OjE0MkFERjpDREQ3OUE6MTBBMkM1MTo2QUZGRjMwRiIsInZpc2l0b3JfaWQiOiI0NzY1Mzg4NjQ5MDQ0ODk4NTc1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 51ca3834598c16bf03fc32e3e879724ed0456710381389fcaacae7e66f24205f |
| hovercard-subject-tag | issue:457033800 |
| 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/7008/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fb9f206ae5456dbb889caa41c4924e979b415f3137f7479fc5900da49e25cb2f/python/mypy/issues/7008 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fb9f206ae5456dbb889caa41c4924e979b415f3137f7479fc5900da49e25cb2f/python/mypy/issues/7008 |
| og:image:alt | Eg with the following: from typing import * class Foo: def __bool__(self) -> Literal[True]: return True def some_foo() -> Foo: ... def throw_error(): raise Exception if __name__ == '__main__': prin... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | graingert |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width