summaryrefslogtreecommitdiffstats
path: root/Misc/NEWS.d/next
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2023-08-31 19:45:12 (GMT)
committerGitHub <noreply@github.com>2023-08-31 19:45:12 (GMT)
commitd48760b2f1e28dd3c1a35721939f400a8ab619b8 (patch)
treecf8dbe4f3bf0019e5359918e92fee16827a6b93a /Misc/NEWS.d/next
parent13a00078b81776b23b0b6add69b848382240d1f2 (diff)
downloadcpython-d48760b2f1e28dd3c1a35721939f400a8ab619b8.zip
cpython-d48760b2f1e28dd3c1a35721939f400a8ab619b8.tar.gz
cpython-d48760b2f1e28dd3c1a35721939f400a8ab619b8.tar.bz2
gh-108682: [Enum] raise TypeError if super().__new__ called in custom __new__ (GH-108704)
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.
Diffstat (limited to 'Misc/NEWS.d/next')
-rw-r--r--Misc/NEWS.d/next/Library/2023-08-30-20-10-28.gh-issue-108682.c2gzLQ.rst2
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2023-08-30-20-10-28.gh-issue-108682.c2gzLQ.rst b/Misc/NEWS.d/next/Library/2023-08-30-20-10-28.gh-issue-108682.c2gzLQ.rst
new file mode 100644
index 0000000..148d432
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-08-30-20-10-28.gh-issue-108682.c2gzLQ.rst
@@ -0,0 +1,2 @@
+Enum: raise :exc:`TypeError` if ``super().__new__()`` is called from a
+custom ``__new__``.