bpo-41907: [Enum] fix format() behavior for IntFlag (GH-22497) (GH-23703)

(cherry picked from commit 37440eef7f)
This commit is contained in:
Miss Islington (bot) 2020-12-08 11:52:24 -08:00 committed by GitHub
parent a3a4bf3b8d
commit 14eaa7d752
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View file

@ -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)