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

This commit is contained in:
Ethan Furman 2020-12-08 11:14:10 -08:00 committed by GitHub
parent c168b5078f
commit 37440eef7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View file

@ -658,7 +658,7 @@ def __format__(self, format_spec):
# 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)