Title: ``auto`` for ``StrEnum`` is incorrectly subclassing ``IntFlag`` · Issue #10384 · python/typeshed · GitHub
Open Graph Title: ``auto`` for ``StrEnum`` is incorrectly subclassing ``IntFlag`` · Issue #10384 · python/typeshed
X Title: ``auto`` for ``StrEnum`` is incorrectly subclassing ``IntFlag`` · Issue #10384 · python/typeshed
Description: from enum import StrEnum, auto from typing import reveal_type class Test(StrEnum): test = auto() print(type(Test.test.value)) def func(x: Test): print(reveal_type(x.value)) func(Test.test) On 3.11 this returns: ❯ python test.py Open Graph Description: from enum import StrEnum, auto from typing import reveal_type class Test(StrEnum): test = auto() print(type(Test.test.value)) def func(x: Test): print(reveal_type(x.value)) func(Test.test) On 3.11 ...
X Description: from enum import StrEnum, auto from typing import reveal_type class Test(StrEnum): test = auto() print(type(Test.test.value)) def func(x: Test): print(reveal_type(x.value)) func(Test.test) On 3.11 ...
Opengraph URL: https://github.com/python/typeshed/issues/10384
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"``auto`` for ``StrEnum`` is incorrectly subclassing ``IntFlag``","articleBody":"```python\r\nfrom enum import StrEnum, auto\r\nfrom typing import reveal_type\r\n\r\n\r\nclass Test(StrEnum):\r\n test = auto()\r\n\r\n\r\nprint(type(Test.test.value))\r\n\r\n\r\ndef func(x: Test):\r\n print(reveal_type(x.value))\r\n\r\n\r\nfunc(Test.test)\r\n```\r\n\r\nOn ``3.11`` this returns:\r\n```console\r\n❯ python test.py\r\n\u003cclass 'str'>\r\nRuntime type is 'str'\r\ntest\r\n```\r\n\r\nHowever, both `pyright` and `mypy` reveal the type as being `int` because of:\r\nhttps://github.com/python/typeshed/blob/201940cdc12e61e3bf5bc3ee4c5fd71bcc23fdf9/stdlib/enum.pyi#L289-L290\r\n\r\nThis was introduced all the way back in https://github.com/python/typeshed/pull/1331.\r\n\r\nWell it might be \"mostly\" correct, with `StrEnum` this is clearly false and leads to cases where we couldn't use `StrEnum` without adding `type: ignores` anyway.\r\nI don't really know what the appropriate fix is so I sadly can't contribute one.","author":{"url":"https://github.com/DanielNoord","@type":"Person","name":"DanielNoord"},"datePublished":"2023-06-29T08:59:44Z","url":"https://github.com/python/typeshed/issues/10384"}
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:710ce947-6ef5-84b7-f2d7-64cc22246805 current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id C180:21E5F:1E382A:28D38C:6B0021EC html-safe-nonce 06e96e5d12ee9bae74c86fd54aef2a206f724a516e1a333716a19cfb474e0bc1 visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMTgwOjIxRTVGOjFFMzgyQToyOEQzOEM6NkIwMDIxRUMiLCJ2aXNpdG9yX2lkIjoiNDY3Njg4MTA4MTE1NTE5OTQ2OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 visitor-hmac 2f033b9ebdbbad0a18f407dbbd0612c57fb00b5aabd0130be03d28c6da4779a7 hovercard-subject-tag issue:1780413528 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/typeshed/10384/issue_layout twitter:image https://opengraph.githubassets.com/d4ec51f7f0a95a08aa50f3dde34571042f1d790bd91d8d2e79aaee4231ffde35/python/typeshed/issues/10384 twitter:card summary_large_image og:image https://opengraph.githubassets.com/d4ec51f7f0a95a08aa50f3dde34571042f1d790bd91d8d2e79aaee4231ffde35/python/typeshed/issues/10384 og:image:alt from enum import StrEnum, auto from typing import reveal_type class Test(StrEnum): test = auto() print(type(Test.test.value)) def func(x: Test): print(reveal_type(x.value)) func(Test.test) On 3.11 ... og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username DanielNoord hostname github.com expected-hostname github.com None 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 turbo-cache-control no-preview go-import github.com/python/typeshed git https://github.com/python/typeshed.git octolytics-dimension-user_id 1525981 octolytics-dimension-user_login python octolytics-dimension-repository_id 31696383 octolytics-dimension-repository_nwo python/typeshed octolytics-dimension-repository_public true octolytics-dimension-repository_is_fork false octolytics-dimension-repository_network_root_id 31696383 octolytics-dimension-repository_network_root_nwo python/typeshed 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
URLs of crawlers that visited me.