You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
raiseValueError('invalid enum member name(s) '.format(
','.join(repr(n) fornininvalid_names)))
(This was later reverted in 42a64c0 and reintroduced in 83d544b, but I believe the code to be the same).
However, 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:
$ python3.10 -c "import enum; enum.Enum('A', ['mro'])"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.10/enum.py", line 387, in __call__returncls._create_(
File "/usr/lib/python3.10/enum.py", line 518, in _create_
enum_class = metacls.__new__(metacls, class_name, bases, classdict)
File "/usr/lib/python3.10/enum.py", line 208, in __new__raiseValueError('Invalid enum member name: {0}'.format(
ValueError: Invalid enum member name: mro
$ python3.11 -c "import enum; enum.Enum('A', ['mro'])"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.11/enum.py", line 791, in __call__returncls._create_(
^^^^^^^^^^^^^
File "/usr/lib/python3.11/enum.py", line 966, in _create_return metacls.__new__(metacls, class_name, bases, classdict, boundary=boundary)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/enum.py", line 483, in __new__raiseValueError('invalid enum member name(s) '.format(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ValueError: invalid enum member name(s)
Given that the .format() is still there, I'm assuming that was an accident.
(Found by running flake8 over Lib/ out of curiosity, see #93010 (comment))
Your environment
CPython versions tested on: Python 3.11.0b1
Operating system and architecture: Archlinux x86_64
The text was updated successfully, but these errors were encountered:
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
(This was later reverted in 42a64c0 and reintroduced in 83d544b, but I believe the code to be the same).
However, 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:Given that the
.format()
is still there, I'm assuming that was an accident.(Found by running
flake8
overLib/
out of curiosity, see #93010 (comment))Your environment
The text was updated successfully, but these errors were encountered: