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.

Created on 2020-02-23 09:07 by jonasmalaco, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 18641 closed dorosch, 2020-02-24 08:00
PR 22277 merged ethan.furman, 2020-09-16 14:02
PR 22282 merged ethan.furman, 2020-09-16 17:30
PR 22283 merged ethan.furman, 2020-09-16 17:34
Messages (6)
msg362496 - (view) Author: Jonas Malaco (jonasmalaco) Date: 2020-02-23 09:07
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.
msg364209 - (view) Author: Ashwin Ramaswami (epicfaace) * Date: 2020-03-15 02:11
I can't reproduce this on the latest python (3.9) from master. Can you?
msg364210 - (view) Author: Ashwin Ramaswami (epicfaace) * Date: 2020-03-15 02:11
Never mind, I was able to reproduce it.
msg377004 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2020-09-16 17:26
 New changeset c95ad7a91fbd7636f33a098d3b39964ab083bf49 by Ethan Furman in branch 'master': bpo-39728: Enum: fix duplicate `ValueError` (GH-22277) https://github.com/python/cpython/commit/c95ad7a91fbd7636f33a098d3b39964ab083bf49 
msg377033 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2020-09-17 00:37
 New changeset a9ba8ba9a71f3cb8d274c354ff67b6206abeb8ac by Ethan Furman in branch '3.9': [3.9] bpo-39728: Enum: fix duplicate `ValueError` (GH-22277) (GH-22282) https://github.com/python/cpython/commit/a9ba8ba9a71f3cb8d274c354ff67b6206abeb8ac 
msg377034 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2020-09-17 00:38
 New changeset 5efb1a77e75648012f8b52960c8637fc296a5c6d by Ethan Furman in branch '3.8': [3.8] bpo-39728: Enum: fix duplicate `ValueError` (GH-22277) (GH-22283) https://github.com/python/cpython/commit/5efb1a77e75648012f8b52960c8637fc296a5c6d 
History
Date User Action Args
2022-04-11 14:59:27adminsetgithub: 83909
2020-09-17 00:39:09ethan.furmansetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-09-17 00:38:18ethan.furmansetmessages: + msg377034
2020-09-17 00:37:55ethan.furmansetmessages: + msg377033
2020-09-16 17:34:09ethan.furmansetpull_requests: + pull_request21335
2020-09-16 17:30:04ethan.furmansetpull_requests: + pull_request21334
2020-09-16 17:26:57ethan.furmansetmessages: + msg377004
2020-09-16 14:02:58ethan.furmansetpull_requests: + pull_request21330
2020-09-16 11:28:41ethan.furmansetversions: + Python 3.10
2020-03-15 02:11:48epicfaacesetmessages: + msg364210
2020-03-15 02:11:01epicfaacesetnosy: + epicfaace
messages: + msg364209
2020-02-24 08:00:06doroschsetkeywords: + patch
nosy: + dorosch

pull_requests: + pull_request18007
stage: test needed -> patch review
2020-02-23 15:09:55ethan.furmansetassignee: ethan.furman
stage: test needed
2020-02-23 09:10:47xtreaksetnosy: + barry, eli.bendersky, ethan.furman
2020-02-23 09:07:04jonasmalacocreate