bpo-41811: create SortKey members using first given value (GH-22316) (GH-22325)
(cherry picked from commit ae0d2a33ec05aece939a959d36fcf1df1e210a08)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
diff --git a/Lib/pstats.py b/Lib/pstats.py
index e781b91..0f93ae0 100644
--- a/Lib/pstats.py
+++ b/Lib/pstats.py
@@ -45,9 +45,9 @@
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