Title: Generate an error if trying to use @final with TypedDict · Issue #7849 · python/mypy · GitHub
Open Graph Title: Generate an error if trying to use @final with TypedDict · Issue #7849 · python/mypy
X Title: Generate an error if trying to use @final with TypedDict · Issue #7849 · python/mypy
Description: @final doesn't work as expected with TypedDicts, but mypy doesn't complain about it: from typing_extensions import final, TypedDict @final # No error here class C(TypedDict): x: float y: int z: str class D(C): # No error here pass This i...
Open Graph Description: @final doesn't work as expected with TypedDicts, but mypy doesn't complain about it: from typing_extensions import final, TypedDict @final # No error here class C(TypedDict): x: float y: int z: str...
X Description: @final doesn't work as expected with TypedDicts, but mypy doesn't complain about it: from typing_extensions import final, TypedDict @final # No error here class C(TypedDict): x: float y: in...
Opengraph URL: https://github.com/python/mypy/issues/7849
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Generate an error if trying to use @final with TypedDict","articleBody":"`@final` doesn't work as expected with TypedDicts, but mypy doesn't complain about it:\r\n\r\n```py\r\nfrom typing_extensions import final, TypedDict\r\n\r\n@final # No error here\r\nclass C(TypedDict):\r\n x: float\r\n y: int\r\n z: str\r\n\r\nclass D(C): # No error here\r\n pass\r\n\r\n```\r\n\r\nThis is confusing, since users would expect that `@final` prevents structural subtyping, but that's not the case. The simplest fix would be to generate an error if `@final` is used in a TypedDict definition.\r\n\r\nHints: This should be a pretty simple thing to fix. Look at what happens in `analyze_class` in `mypy/semanal.py`.\r\n\r\nOriginally reported in #7845.","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2019-11-01T17:18:23Z","url":"https://github.com/python/mypy/issues/7849"}
| 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:6b11dae0-ddfb-702c-ed62-b61be1f97804 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DFCA:14B836:E6D36D:1359942:6B005770 |
| html-safe-nonce | 93e0c9358231b00799142bb57623c20919ffd93afbf2d2183bb6bc3a4f1614b5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERkNBOjE0QjgzNjpFNkQzNkQ6MTM1OTk0Mjo2QjAwNTc3MCIsInZpc2l0b3JfaWQiOiI3Nzc2ODU3NjE1MzIxMjI5OTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fb69e614610dafaf82a7b1f2e9c60710287f196c317a9b32cad0690aecc34c34 |
| hovercard-subject-tag | issue:516242412 |
| 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/7849/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a232246a88530e341734975bc637c90febbdf827d62cc4c1850fb3891c1547a1/python/mypy/issues/7849 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a232246a88530e341734975bc637c90febbdf827d62cc4c1850fb3891c1547a1/python/mypy/issues/7849 |
| og:image:alt | @final doesn't work as expected with TypedDicts, but mypy doesn't complain about it: from typing_extensions import final, TypedDict @final # No error here class C(TypedDict): x: float y: int z: str... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JukkaL |
| 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