Title: Enum does not work if member is an instance of types.GenericAlias · Issue #93847 · python/cpython · GitHub
Open Graph Title: Enum does not work if member is an instance of types.GenericAlias · Issue #93847 · python/cpython
X Title: Enum does not work if member is an instance of types.GenericAlias · Issue #93847 · python/cpython
Description: Enums does not work with generic alias of builtin types, like list[int]. >>> class E(enum.Enum): ... L = list[int] ... >>> E.L Traceback (most recent call last): File "
Open Graph Description: Enums does not work with generic alias of builtin types, like list[int]. >>> class E(enum.Enum): ... L = list[int] ... >>> E.L Traceback (most recent call last): File "
X Description: Enums does not work with generic alias of builtin types, like list[int]. >>> class E(enum.Enum): ... L = list[int] ... >>> E.L Traceback (most recent call last): File "<st...
Opengraph URL: https://github.com/python/cpython/issues/93847
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Enum does not work if member is an instance of types.GenericAlias","articleBody":"Enums does not work with generic alias of builtin types, like `list[int]`.\r\n```\r\n\u003e\u003e\u003e class E(enum.Enum):\r\n... L = list[int]\r\n... \r\n\u003e\u003e\u003e E.L\r\nTraceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n File \"/home/serhiy/py/cpython/Lib/enum.py\", line 1241, in __repr__\r\n return \"\u003c%s.%s: %s\u003e\" % (self.__class__.__name__, self._name_, v_repr(self._value_))\r\n ^^^^^^^^^^^^^^^^^^^^\r\nTypeError: descriptor '__repr__' requires a 'type' object but received a 'types.GenericAlias'\r\n```\r\nAll works with `typing.List[int]`.\r\n```\r\n\u003e\u003e\u003e class E(enum.Enum):\r\n... L = List[int]\r\n... \r\n\u003e\u003e\u003e E.L\r\n\u003cE.L: typing.List[int]\u003e\r\n```\r\nThis is a manifestation of the #89828 bug.","author":{"url":"https://github.com/serhiy-storchaka","@type":"Person","name":"serhiy-storchaka"},"datePublished":"2022-06-15T10:54:30.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/93847/cpython/issues/93847"}
| 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:99f1476c-a667-0b00-e863-63267f106348 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED98:27E9DD:19E3DCB:244E5BA:696A4F31 |
| html-safe-nonce | 03088a410f6f6df261aabd0d0f3fd3a65cfcbb4dd9641ec015718344f85435d3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDk4OjI3RTlERDoxOUUzRENCOjI0NEU1QkE6Njk2QTRGMzEiLCJ2aXNpdG9yX2lkIjoiODQwNjIwMDUyNzExNTQwNzE1MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | cc928a718cd22637145a6270b69c095ade5beda24dcf9c268352919b9021b2b0 |
| hovercard-subject-tag | issue:1272051239 |
| 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/cpython/93847/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bf4ca5fc197e80b23140b96662832f2d884097005e9b8ae0adedb40ce6dbd136/python/cpython/issues/93847 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bf4ca5fc197e80b23140b96662832f2d884097005e9b8ae0adedb40ce6dbd136/python/cpython/issues/93847 |
| og:image:alt | Enums does not work with generic alias of builtin types, like list[int]. >>> class E(enum.Enum): ... L = list[int] ... >>> E.L Traceback (most recent call last): File " |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | serhiy-storchaka |
| hostname | github.com |
| expected-hostname | github.com |
| None | 3f871c8e07f0ae1886fa8dac284166d28b09ad5bada6476fc10b674e489788ef |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| 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 | 63c426b30d262aba269ef14c40e3c817b384cd61 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width