[3.12] gh-115821: [Enum] better error message for calling super().__new__() (GH-116065)
https://github.com/python/cpython/commit/83ff92d225816bc23073e9d5a57cc117a4f... commit: 83ff92d225816bc23073e9d5a57cc117a4f25714 branch: 3.12 author: Ethan Furman <ethan@stoneleaf.us> committer: ethanfurman <ethan@stoneleaf.us> date: 2024-02-28T15:17:20-08:00 summary: [3.12] gh-115821: [Enum] better error message for calling super().__new__() (GH-116065) Add note to not call super().__new__() in docs. files: M Doc/library/enum.rst diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index 4719c462a49c55..a03961b9a1ebce 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
participants (1)
-
ethanfurman