Repository navigation
Enum works in python 3.10 breaks in 3.11 #104271
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on May 7, 2023 - added a commit that references this issue
on May 7, 2023 I confirmed the issue and proposed a fix in gh-104279
I think iterating the list of
last_valuesin gh-91457 in sorted order (instead of reversed sorted order) was an oversightin any case, @naringas, it seems that this use of
auto()will be deprecated in 3.13.
you should be able to fix this in your code by overriding_generate_next_value_to get your desired behavior in a way that works with older python versions.Reacted by b sin any case, @naringas, it seems that this use of
auto()will be deprecated in 3.13. you should be able to fix this in your code by overriding_generate_next_value_to get your desired behavior in a way that works with older python versions.I think the issue came from how I use
Enumwith mixed values; I have values either as strings, or 'auto'.Now that I've had to think about this, I realize expect unique (hence the decorator to error out if this fails) numerical values. I think this is a valid expectation for a unique Enum type with mixed values.
question: this issue gets closed if/when the PR gets merged?
question: this issue gets closed if/when the PR gets merged?
I think so, although it's up to the codeowner (Ethan) to decide if and how this should be fixed
- addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory3.11only security fixesonly security fixes3.12only security fixesonly security fixes
on May 8, 2023 @ethanfurman what do you think about this issue and proposed fix?
Apologies for the delay, I'll try to get to this this week. In general I agree with the proposed solution.
Reacted by Itamar Oren- added a commit that references this issue
on May 23, 2023
Bug report
I have this (simplified) code
I tested this (I developed it) using python 3.10.8.
My friend ran it in 3.11.3 and it breaks like this:
We can work around the problem using a
StrEnumand it's all fine. But I think this is a regression bug. I don't think my code should break like this because the standard library changed.Also, fyi, StrEnum is new in 3.11 so I cannot just adjust my own code (which works well).
Linked PRs