Title: Superclass fields incorrectly assumed to exist · Issue #2877 · python/mypy · GitHub
Open Graph Title: Superclass fields incorrectly assumed to exist · Issue #2877 · python/mypy
X Title: Superclass fields incorrectly assumed to exist · Issue #2877 · python/mypy
Description: Mypy seems to always assume that classes have all fields defined in their superclass' __init__ method, even if their own __init__ never calls the superclass constructor and those fields therefore don't exist. class A: def __init__(self) ...
Open Graph Description: Mypy seems to always assume that classes have all fields defined in their superclass' __init__ method, even if their own __init__ never calls the superclass constructor and those fields therefore d...
X Description: Mypy seems to always assume that classes have all fields defined in their superclass' __init__ method, even if their own __init__ never calls the superclass constructor and those fields therefo...
Opengraph URL: https://github.com/python/mypy/issues/2877
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Superclass fields incorrectly assumed to exist","articleBody":"Mypy seems to always assume that classes have all fields defined in their superclass' `__init__` method, even if their own `__init__` never calls the superclass constructor and those fields therefore don't exist. \r\n\r\n```python\r\nclass A:\r\n def __init__(self) -> None:\r\n self.a = 12\r\n\r\n\r\nclass B(A):\r\n def __init__(self) -> None:\r\n self.b = 14\r\n\r\n\r\ndef m() -> int:\r\n ab = B()\r\n return ab.a + ab.b # accepted by mypy, but fails at runtime\r\n```","author":{"url":"https://github.com/marcoeilers","@type":"Person","name":"marcoeilers"},"datePublished":"2017-02-17T10:36:11Z","url":"https://github.com/python/mypy/issues/2877"}
| 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:14f7674f-c1e7-8041-436e-2b5321e388a3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9CDC:1EE55B:1E53BFE:2978EFB:6B001CBE |
| html-safe-nonce | 624cac9b00adb70be3883fa3b26e74870e6038699e7134850823a4d42b3eda7c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0RDOjFFRTU1QjoxRTUzQkZFOjI5NzhFRkI6NkIwMDFDQkUiLCJ2aXNpdG9yX2lkIjoiNTc3MTIyMjkzODQwMTM4MTU2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 9edeafd40d00749731c039f045ceb18fcebfd3113ef7f39bfecdbd0590755776 |
| hovercard-subject-tag | issue:208401268 |
| 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/2877/issue_layout |
| twitter:image | https://opengraph.githubassets.com/78c9d3a8cee6436b89a34bc5d9034d4b48ab19fd1552895ea09945af734f01cb/python/mypy/issues/2877 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/78c9d3a8cee6436b89a34bc5d9034d4b48ab19fd1552895ea09945af734f01cb/python/mypy/issues/2877 |
| og:image:alt | Mypy seems to always assume that classes have all fields defined in their superclass' __init__ method, even if their own __init__ never calls the superclass constructor and those fields therefore d... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | marcoeilers |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width