Title: Catch TypeVisitor subclasses with unimplemented abstract methods · Issue #730 · python/mypy · GitHub
Open Graph Title: Catch TypeVisitor subclasses with unimplemented abstract methods · Issue #730 · python/mypy
X Title: Catch TypeVisitor subclasses with unimplemented abstract methods · Issue #730 · python/mypy
Description: Issue #638 was a pain to find because the root cause is an unimplemented abstract method which silently returns None and somewhere down the line causes type checking to fail. It would be better to check this explicitly. The following sho...
Open Graph Description: Issue #638 was a pain to find because the root cause is an unimplemented abstract method which silently returns None and somewhere down the line causes type checking to fail. It would be better to ...
X Description: Issue #638 was a pain to find because the root cause is an unimplemented abstract method which silently returns None and somewhere down the line causes type checking to fail. It would be better to ...
Opengraph URL: https://github.com/python/mypy/issues/730
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Catch TypeVisitor subclasses with unimplemented abstract methods","articleBody":"Issue #638 was a pain to find because the root cause is an unimplemented abstract method which silently returns `None` and somewhere down the line causes type checking to fail. It would be better to check this explicitly. The following shows that this is done for one of the abstract methods:\nhttps://github.com/JukkaL/mypy/blob/bbb2dd4f07f995a4b28b8044fa91aa97960fe192/mypy/types.py#L532. There are two potential solutions: 1) use abc's @abstractmethod decorator, 2) raise an error directly in TypeVisitor.\n\n1) Ensures that future implementations and changes catch subclasses which do not implement the abstract methods, but requires adding implementations for all of the abstract methods to existing subclasses which are missing them. As there are a few, it would probably be simplest to raise an error there instead of providing the complete implementation, which raises the question: why not just use 2) straight off the bat?\n\n@JukkaL Do you have a preferred solution?\n","author":{"url":"https://github.com/JamesGuthrie","@type":"Person","name":"JamesGuthrie"},"datePublished":"2015-07-27T12:29:58Z","url":"https://github.com/python/mypy/issues/730"}
| 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:7cc6ef7d-08ce-521e-bc94-5b47d6c562c0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C5EA:3E7030:C6AFC2:10AD153:6B005288 |
| html-safe-nonce | 1b41d2aa723d795a059c96071c9747089a1cb21fff4b34790164c995829e1431 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNUVBOjNFNzAzMDpDNkFGQzI6MTBBRDE1Mzo2QjAwNTI4OCIsInZpc2l0b3JfaWQiOiI4NTgyMjAxOTQ3NTYwMzY2NzI4IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f8754b5c363a2997e980703ebc029d8a9596c851f0f9143aaf8acd986d80b770 |
| hovercard-subject-tag | issue:97452227 |
| 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/730/issue_layout |
| twitter:image | https://opengraph.githubassets.com/566eb662ffa67c153be8f144330949a70e4746245537c85d56cbb73d6af134bf/python/mypy/issues/730 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/566eb662ffa67c153be8f144330949a70e4746245537c85d56cbb73d6af134bf/python/mypy/issues/730 |
| og:image:alt | Issue #638 was a pain to find because the root cause is an unimplemented abstract method which silently returns None and somewhere down the line causes type checking to fail. It would be better to ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JamesGuthrie |
| hostname | github.com |
| expected-hostname | github.com |
| None | f420f4996e6b1ff1ccd6d7683f8134f4b5f0f8a50124c210dbfe7490e5644abb |
| 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 | 26e00df917aba0f128135dc073ea0c5e33a70d40 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width