]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
bpo-41789: honor object overrides in Enum classes (GH-22250)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 16 Sep 2020 00:16:36 +0000 (17:16 -0700)
committerGitHub <noreply@github.com>
Wed, 16 Sep 2020 00:16:36 +0000 (17:16 -0700)
commit929112ef81ccef20d3aef25c8a1142059ee941da
tree6cf804656766ed3b21d5ab765245b13fa8ef127a
parent8f8ebcca95d3b6ed0a522a9736ab53d6d4f0208c
bpo-41789: honor object overrides in Enum classes (GH-22250)

EnumMeta double-checks that `__repr__`, `__str__`, `__format__`, and `__reduce_ex__` are not the same as `object`'s, and replaces them if they are -- even if that replacement was intentionally done in the Enum being constructed.  This patch fixes that.

Automerge-Triggered-By: @ethanfurman
(cherry picked from commit 22415ad62555d79bd583b4a7d6a96006624a8277)

Co-authored-by: Ethan Furman <ethan@stoneleaf.us>
Lib/enum.py
Lib/test/test_enum.py
Misc/NEWS.d/next/Library/2020-09-14-19-27-46.bpo-41789.pI_uZQ.rst [new file with mode: 0644]