From 83ff92d225816bc23073e9d5a57cc117a4f25714 Mon Sep 17 00:00:00 2001 From: Ethan Furman Date: Wed, 28 Feb 2024 15:17:20 -0800 Subject: [3.12] gh-115821: [Enum] better error message for calling super().__new__() (GH-116065) Add note to not call super().__new__() in docs. --- Doc/library/enum.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index 4719c46..a03961b 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -390,6 +390,9 @@ Data Types results in the call ``int('1a', 16)`` and a value of ``17`` for the member. + ..note:: When writing a custom ``__new__``, do not use ``super().__new__`` -- + call the appropriate ``__new__`` instead. + .. method:: Enum.__repr__(self) Returns the string used for *repr()* calls. By default, returns the -- cgit v0.12