Title: Enum final checking false positive in complex case · Issue #11702 · python/mypy · GitHub
Open Graph Title: Enum final checking false positive in complex case · Issue #11702 · python/mypy
X Title: Enum final checking false positive in complex case · Issue #11702 · python/mypy
Description: This code generates a false positive, but weirdly I can only reproduce it if the base class is defined in a different module: from mod import E class EE(E): # Cannot inherit from final class "E" X = (0, "") # mod.py from enum import Enum...
Open Graph Description: This code generates a false positive, but weirdly I can only reproduce it if the base class is defined in a different module: from mod import E class EE(E): # Cannot inherit from final class "E" X ...
X Description: This code generates a false positive, but weirdly I can only reproduce it if the base class is defined in a different module: from mod import E class EE(E): # Cannot inherit from final class "...
Opengraph URL: https://github.com/python/mypy/issues/11702
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enum final checking false positive in complex case","articleBody":"This code generates a false positive, but weirdly I can only reproduce it if the base class is defined in a different module:\r\n\r\n```py\r\nfrom mod import E\r\n\r\nclass EE(E): # Cannot inherit from final class \"E\"\r\n X = (0, \"\")\r\n```\r\n\r\n```py\r\n# mod.py\r\nfrom enum import Enum\r\nfrom typing import Optional, Type\r\n\r\nclass E(int, Enum):\r\n def __init__(self, _: int, x: Optional[str] = None) -> None:\r\n self.x = x\r\n\r\n def __new__(cls: Type['E'], value: int, x: Optional[str] = None) -> 'E':\r\n enum = int.__new__(cls, value)\r\n enum._value_ = value\r\n enum.x = x\r\n return enum\r\n```\r\n\r\nThe code works at runtime.\r\n\r\nThis started happening as a side effect of #11247.\r\n\r\nMarking as high priority, since this is a regression. If it seems clear that this may only happen in pretty specialized circumstances, we can perhaps lower the priority.\r\n\r\ncc @sobolevn ","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2021-12-10T16:21:02Z","url":"https://github.com/python/mypy/issues/11702"}
| 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:1f52368d-c6da-82d6-6819-3e6f8f3964dc |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9628:30501:B37133:F1F523:6B004E1E |
| html-safe-nonce | 67bce811bab79fd53c3e4d336c7316bb6c5ff7d13f41ac3bd31ed77926c2748d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NjI4OjMwNTAxOkIzNzEzMzpGMUY1MjM6NkIwMDRFMUUiLCJ2aXNpdG9yX2lkIjoiMTYzOTg4ODkxNDIxNjkzMDg0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2b05621d29b563ce1834195209c3a5fad5071aee7afb92ce671cabcb34bd7625 |
| hovercard-subject-tag | issue:1077014665 |
| 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/11702/issue_layout |
| twitter:image | https://opengraph.githubassets.com/791c5079be0073129296cd13697b74c216db3b593999f1442f931b51c5b6159f/python/mypy/issues/11702 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/791c5079be0073129296cd13697b74c216db3b593999f1442f931b51c5b6159f/python/mypy/issues/11702 |
| og:image:alt | This code generates a false positive, but weirdly I can only reproduce it if the base class is defined in a different module: from mod import E class EE(E): # Cannot inherit from final class "E" X ... |
| 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 | f9517bf360d46638a1e5e7daee7158842fe5ef43c9000afa0e127564a7c2f39b |
| 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 | b27c5dde30676028abd5c5fc53ce5c9b625f8281 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width