diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2021-06-18 21:25:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-18 21:25:42 (GMT) |
commit | 1b4addf3cbd0ef424939681ee67c802328d567ba (patch) | |
tree | 19585bbf105f9d2b3cdc274f7e1b51ba30e4d632 /Python/compile.c | |
parent | a8c418d5ed1103106db547aa576b82c6031985a4 (diff) | |
download | cpython-1b4addf3cbd0ef424939681ee67c802328d567ba.zip cpython-1b4addf3cbd0ef424939681ee67c802328d567ba.tar.gz cpython-1b4addf3cbd0ef424939681ee67c802328d567ba.tar.bz2 |
[3.10] bpo-43945: [Enum] reduce scope of new format() behavior (GH-26752)
* [Enum] reduce scope of new format behavior
Instead of treating all Enums the same for format(), only user mixed-in
enums will be affected. In other words, IntEnum and IntFlag will not be
changing the format() behavior, due to the requirement that they be
drop-in replacements of existing integer constants.
If a user creates their own integer-based enum, then the new behavior
will apply:
class Grades(int, Enum):
A = 5
B = 4
C = 3
D = 2
F = 0
Now: format(Grades.B) -> DeprecationWarning and '4'
3.12: -> no warning, and 'B'.
(cherry picked from commit f60b07ab6c943fce084772c3c7731ab3bbd213ff)
Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Diffstat (limited to 'Python/compile.c')
0 files changed, 0 insertions, 0 deletions