This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jonasmalaco
Recipients jonasmalaco
Date 2020-02-23.09:07:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582448824.79.0.766917894274.issue39728@roundup.psfhosted.org>
In-reply-to
Content
Trying to instantiate an enum with an invalid value results in "During handling of the above exception, another exception occurred:". $ cat > test.py << EOF from enum import Enum class Color(Enum): RED = 1 GREEN = 2 BLUE = 3 Color(0) EOF $ python --version Python 3.8.1 $ python test.py ValueError: 0 is not a valid Color During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 8, in <module> Color(0) File "/usr/lib/python3.8/enum.py", line 304, in __call__ return cls.__new__(cls, value) File "/usr/lib/python3.8/enum.py", line 595, in __new__ raise exc File "/usr/lib/python3.8/enum.py", line 579, in __new__ result = cls._missing_(value) File "/usr/lib/python3.8/enum.py", line 608, in _missing_ raise ValueError("%r is not a valid %s" % (value, cls.__name__)) ValueError: 0 is not a valid Color I think this might be related to 019f0a0cb85e ("bpo-34536: raise error for invalid _missing_ results (GH-9147)"), but I haven't been able to confirm.
History
Date User Action Args
2020-02-23 09:07:04jonasmalacosetrecipients: + jonasmalaco
2020-02-23 09:07:04jonasmalacosetmessageid: <1582448824.79.0.766917894274.issue39728@roundup.psfhosted.org>
2020-02-23 09:07:04jonasmalacolinkissue39728 messages
2020-02-23 09:07:04jonasmalacocreate