diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2023-09-08 01:57:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-08 01:57:48 (GMT) |
commit | effa2ecdcf0d019d6ed04ca160f789af57e959de (patch) | |
tree | a5d44fdee56a2fc0e83f8734ccd2858981aa9493 /Python/bootstrap_hash.c | |
parent | e46be0d2fa18d7e3435c3b19370604043b1f8cf0 (diff) | |
download | cpython-effa2ecdcf0d019d6ed04ca160f789af57e959de.zip cpython-effa2ecdcf0d019d6ed04ca160f789af57e959de.tar.gz cpython-effa2ecdcf0d019d6ed04ca160f789af57e959de.tar.bz2 |
[3.11] gh-108682: [Enum] raise TypeError if super().__new__ called in custom __new__ (GH-108704) (GH-108739)
When overriding the `__new__` method of an enum, the underlying data type should be created directly; i.e. .
member = object.__new__(cls)
member = int.__new__(cls, value)
member = str.__new__(cls, value)
Calling `super().__new__()` finds the lookup version of `Enum.__new__`, and will now raise an exception when detected.
(cherry picked from commit d48760b2f1e28dd3c1a35721939f400a8ab619b8)
Diffstat (limited to 'Python/bootstrap_hash.c')
0 files changed, 0 insertions, 0 deletions