Title: `enum`: Member names accidentally removed from "invalid enum member name(s)" message · Issue #93118 · python/cpython · GitHub
Open Graph Title: `enum`: Member names accidentally removed from "invalid enum member name(s)" message · Issue #93118 · python/cpython
X Title: `enum`: Member names accidentally removed from "invalid enum member name(s)" message · Issue #93118 · python/cpython
Description: Bug report In acf7403 (#30582), @ethanfurman changed the "Invalid enum member name" error message to "invalid enum member name(s)": cpython/Lib/enum.py Lines 482 to 484 in b2694ab if invalid_names: raise ValueError('invalid enum member n...
Open Graph Description: Bug report In acf7403 (#30582), @ethanfurman changed the "Invalid enum member name" error message to "invalid enum member name(s)": cpython/Lib/enum.py Lines 482 to 484 in b2694ab if invalid_names:...
X Description: Bug report In acf7403 (#30582), @ethanfurman changed the "Invalid enum member name" error message to "invalid enum member name(s)": cpython/Lib/enum.py Lines 482 to 484 in b2694...
Opengraph URL: https://github.com/python/cpython/issues/93118
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`enum`: Member names accidentally removed from \"invalid enum member name(s)\" message","articleBody":"**Bug report**\r\n\r\nIn acf7403f9baea3ae1119fc6b4a3298522188bf96 (#30582), @ethanfurman changed the \"Invalid enum member name\" error message to \"invalid enum member name(s)\":\r\n\r\nhttps://github.com/python/cpython/blob/b2694ab46997746eae7e913738623b39f6334473/Lib/enum.py#L482-L484\r\n\r\n(This was later reverted in 42a64c03ec5c443f2a5c2ee4284622f5d1f5326c and reintroduced in 83d544b9292870eb44f6fca37df0aa351c4ef83a, but I believe the code to be the same).\r\n\r\nHowever, the commit also removed `{0}` from the format string, thus removing the invalid names from the error messages. As a result, the error message is now less descriptive:\r\n\r\n```pytb\r\n$ python3.10 -c \"import enum; enum.Enum('A', ['mro'])\"\r\nTraceback (most recent call last):\r\n File \"\u003cstring\u003e\", line 1, in \u003cmodule\u003e\r\n File \"/usr/lib/python3.10/enum.py\", line 387, in __call__\r\n return cls._create_(\r\n File \"/usr/lib/python3.10/enum.py\", line 518, in _create_\r\n enum_class = metacls.__new__(metacls, class_name, bases, classdict)\r\n File \"/usr/lib/python3.10/enum.py\", line 208, in __new__\r\n raise ValueError('Invalid enum member name: {0}'.format(\r\nValueError: Invalid enum member name: mro\r\n```\r\n\r\n```pytb\r\n$ python3.11 -c \"import enum; enum.Enum('A', ['mro'])\"\r\nTraceback (most recent call last):\r\n File \"\u003cstring\u003e\", line 1, in \u003cmodule\u003e\r\n File \"/usr/lib/python3.11/enum.py\", line 791, in __call__\r\n return cls._create_(\r\n ^^^^^^^^^^^^^\r\n File \"/usr/lib/python3.11/enum.py\", line 966, in _create_\r\n return metacls.__new__(metacls, class_name, bases, classdict, boundary=boundary)\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/usr/lib/python3.11/enum.py\", line 483, in __new__\r\n raise ValueError('invalid enum member name(s) '.format(\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\nValueError: invalid enum member name(s) \r\n```\r\n\r\nGiven that the `.format()` is still there, I'm assuming that was an accident.\r\n\r\n(Found by running `flake8` over `Lib/` out of curiosity, see https://github.com/python/cpython/issues/93010#issuecomment-1133402591)\r\n\r\n**Your environment**\r\n\r\n- CPython versions tested on: Python 3.11.0b1\r\n- Operating system and architecture: Archlinux x86_64","author":{"url":"https://github.com/The-Compiler","@type":"Person","name":"The-Compiler"},"datePublished":"2022-05-23T14:40:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/93118/cpython/issues/93118"}
| 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:5000ebd6-a3d8-d32d-2de1-33794e91e6e2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C720:46014:18BED8B:21404E4:6969AC55 |
| html-safe-nonce | 1839641bbc4a9319ac5f9a8126d44fadcd276351faf75ac4c3ffea7f00433a3b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzIwOjQ2MDE0OjE4QkVEOEI6MjE0MDRFNDo2OTY5QUM1NSIsInZpc2l0b3JfaWQiOiIzMzU3MTEwMjkzMzI0NDc1NDc3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b8fc7cd2814270187cabd0b8b63f25244800b7a3d15492e3ecb59c83ba68122e |
| hovercard-subject-tag | issue:1245275880 |
| 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/93118/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c3090c486877b6608284ca5bc86ba9c8e06003e3dd14aeee116319d0b10f34dd/python/cpython/issues/93118 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c3090c486877b6608284ca5bc86ba9c8e06003e3dd14aeee116319d0b10f34dd/python/cpython/issues/93118 |
| og:image:alt | Bug report In acf7403 (#30582), @ethanfurman changed the "Invalid enum member name" error message to "invalid enum member name(s)": cpython/Lib/enum.py Lines 482 to 484 in b2694ab if invalid_names:... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | The-Compiler |
| hostname | github.com |
| expected-hostname | github.com |
| None | 24c4c97a2d520cb286b35e1a4c22d7a4df3c26a2fa28dd7cdf0e65db327b4de7 |
| 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 | 124667f43168afb6c9c03b7c02eb5b1d2e1be3d9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width