diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2020-09-22 20:00:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 20:00:07 (GMT) |
commit | d986d1657e1e7b50807d0633cb31d96a2d866d42 (patch) | |
tree | 2565f560e2ccacd2655c9e1fcbeff429c27750de /Lib/enum.py | |
parent | 947adcaa13080790167757664912c3a6c2d4c201 (diff) | |
download | cpython-d986d1657e1e7b50807d0633cb31d96a2d866d42.zip cpython-d986d1657e1e7b50807d0633cb31d96a2d866d42.tar.gz cpython-d986d1657e1e7b50807d0633cb31d96a2d866d42.tar.bz2 |
bpo-41816: `StrEnum.__str__` is `str.__str__` (GH-22362)
use `str.__str__` for `StrEnum` so that `str(StrEnum.member)` is the same as directly accessing the string value of the `StrEnum` member
Diffstat (limited to 'Lib/enum.py')
-rw-r--r-- | Lib/enum.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/enum.py b/Lib/enum.py index 589b17f..40ff25b 100644 --- a/Lib/enum.py +++ b/Lib/enum.py @@ -718,6 +718,8 @@ class StrEnum(str, Enum): member._value_ = value return member + __str__ = str.__str__ + def _reduce_ex_by_name(self, proto): return self.name |