Title: Marking a private `Enum` member as `member()` does not work · Issue #18563 · python/mypy · GitHub
Open Graph Title: Marking a private `Enum` member as `member()` does not work · Issue #18563 · python/mypy
X Title: Marking a private `Enum` member as `member()` does not work · Issue #18563 · python/mypy
Description: Consider this example: from enum import Enum, member class Pet(Enum): __CAT = member(1) reveal_type(Pet.__CAT) # N: Revealed type is "enum.member[Literal[1]?]" Link: https://mypy-play.net/?mypy=latest&python=3.12&gist=63b056215c22ba7ff09...
Open Graph Description: Consider this example: from enum import Enum, member class Pet(Enum): __CAT = member(1) reveal_type(Pet.__CAT) # N: Revealed type is "enum.member[Literal[1]?]" Link: https://mypy-play.net/?mypy=lat...
X Description: Consider this example: from enum import Enum, member class Pet(Enum): __CAT = member(1) reveal_type(Pet.__CAT) # N: Revealed type is "enum.member[Literal[1]?]" Link: https://mypy-play.net...
Opengraph URL: https://github.com/python/mypy/issues/18563
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Marking a private `Enum` member as `member()` does not work","articleBody":"Consider this example:\n\n```python\nfrom enum import Enum, member\n\nclass Pet(Enum):\n __CAT = member(1)\n\nreveal_type(Pet.__CAT) # N: Revealed type is \"enum.member[Literal[1]?]\"\n```\n\nLink: https://mypy-play.net/?mypy=latest&python=3.12&gist=63b056215c22ba7ff09e2559dd2ae08a\n\nHowever, in runtimes it fails with `AttributeError`, because `__CAT` is mangled to `_Pet__CAT` as regular private names are.\n\nWe need to fix this corner-case.\n\nRefs https://github.com/python/mypy/issues/18491\nRefs https://github.com/python/mypy/issues/18557","author":{"url":"https://github.com/sobolevn","@type":"Person","name":"sobolevn"},"datePublished":"2025-01-29T08:58:21Z","url":"https://github.com/python/mypy/issues/18563"}
| 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:4e70e076-c68b-7442-9257-59ceca816dc9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D4BE:18B602:35EB3C:4BFC43:6B005E33 |
| html-safe-nonce | bf3074954a6b11a04ecec7b8000e80520894bfc2a5757c9806af20225e116413 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENEJFOjE4QjYwMjozNUVCM0M6NEJGQzQzOjZCMDA1RTMzIiwidmlzaXRvcl9pZCI6IjQ2MzI5Mzg0OTc2NTU3MjU2MTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b876bc727800aa9349482dfc25a3e1b7f598ab69e3e7ebb9bf5edb406461b939 |
| hovercard-subject-tag | issue:2817602343 |
| 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/18563/issue_layout |
| twitter:image | https://opengraph.githubassets.com/07fa7c943451a36a4e9ccf05ca6fdf9f010d19c0a69f5af524cc7e20b0494397/python/mypy/issues/18563 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/07fa7c943451a36a4e9ccf05ca6fdf9f010d19c0a69f5af524cc7e20b0494397/python/mypy/issues/18563 |
| og:image:alt | Consider this example: from enum import Enum, member class Pet(Enum): __CAT = member(1) reveal_type(Pet.__CAT) # N: Revealed type is "enum.member[Literal[1]?]" Link: https://mypy-play.net/?mypy=lat... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sobolevn |
| hostname | github.com |
| expected-hostname | github.com |
| None | 25854482a1773a7c1ebb8be3d2bc1c6e61d82d78126be63b5044474a86d44d9e |
| 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 | e4f5c239e31f1f680e6bbc419ff92d774da616ec |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width