mirror of
https://github.com/python/cpython.git
synced 2025-09-14 04:37:29 +00:00
bpo-41907: [Enum] fix format() behavior for IntFlag (GH-22497) (GH-23703)
(cherry picked from commit 37440eef7f
)
This commit is contained in:
parent
a3a4bf3b8d
commit
14eaa7d752
3 changed files with 16 additions and 1 deletions
|
@ -657,7 +657,7 @@ class Enum(metaclass=EnumMeta):
|
|||
# the value
|
||||
|
||||
# pure Enum branch, or branch with __str__ explicitly overridden
|
||||
str_overridden = type(self).__str__ != Enum.__str__
|
||||
str_overridden = type(self).__str__ not in (Enum.__str__, Flag.__str__)
|
||||
if self._member_type_ is object or str_overridden:
|
||||
cls = str
|
||||
val = str(self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue