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
{{ message }}
Repository navigation
[Enum] Exception being ignored in custom datatypes #102549
In Base init
In MyEnum init
Traceback (most recent call last):
File "/Users/tnie/code/cpython/tmp.py", line 14, in <module>
MyEnum(1)
File "/Users/tnie/code/cpython/Lib/enum.py", line 728, in __call__
return cls.__new__(cls, value)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tnie/code/cpython/Lib/enum.py", line 1132, in __new__
raise ve_exc
ValueError: 1 is not a valid MyEnum
In Base init
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/source/python/cpython/Lib/enum.py", line 561, in __new__
raise exc
File "/source/python/cpython/Lib/enum.py", line 278, in __set_name__
raise TypeError(
TypeError: _value_ not set in __new__, unable to create it
>>> MyEnum
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'MyEnum' is not defined
Activity
kwsp commentedon Mar 9, 2023
Just tested this -
MyEnumis indeed not created and theValueErroris raised.Output
What behaviour are you describing that's a bug?
ethanfurman commentedon Mar 9, 2023
MyEnumshould not have been created in the first place. The behavior in the patch I'm working on:and
pythongh-102549: [Enum] fail enum creation when data type raises in _…
gh-102549: [Enum] fail enum creation when data type raises in __init__ (
gh-102549: [Enum] fail enum creation when data type raises in __init__ (
pythongh-102549: [Enum] fail enum creation when data type raises in _…