Skip to content

Commit 3e8480c

Browse files
oscar-LTethanfurman
authored andcommitted
Fix issue affecting the use of auto() alongside aliases in Enums
1 parent 47e3562 commit 3e8480c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Lib/enum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,7 @@ def _generate_next_value_(name, start, count, last_values):
12141214
count: the number of existing members
12151215
last_value: the last value assigned or None
12161216
"""
1217-
for last_value in reversed(last_values):
1217+
for last_value in sorted(last_values, reverse=True):
12181218
try:
12191219
return last_value + 1
12201220
except TypeError:
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fixed an issue with Enums where the default behavior of auto() was
2+
generating incorrect values following alias assignment

0 commit comments

Comments
 (0)