mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-41811: create SortKey members using first given value (GH-22316) (GH-22325)
(cherry picked from commit ae0d2a33ec
)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
This commit is contained in:
parent
9e73cac173
commit
0e4d526de4
2 changed files with 7 additions and 3 deletions
|
@ -45,9 +45,9 @@ class SortKey(str, Enum):
|
|||
TIME = 'time', 'tottime'
|
||||
|
||||
def __new__(cls, *values):
|
||||
obj = str.__new__(cls)
|
||||
|
||||
obj._value_ = values[0]
|
||||
value = values[0]
|
||||
obj = str.__new__(cls, value)
|
||||
obj._value_ = value
|
||||
for other_value in values[1:]:
|
||||
cls._value2member_map_[other_value] = obj
|
||||
obj._all_values = values
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue