]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-115821: [Enum] better error message for calling super().__new__() (GH-116065)
authorEthan Furman <ethan@stoneleaf.us>
Wed, 28 Feb 2024 23:17:20 +0000 (15:17 -0800)
committerGitHub <noreply@github.com>
Wed, 28 Feb 2024 23:17:20 +0000 (15:17 -0800)
Add note to not call super().__new__() in docs.

Doc/library/enum.rst

index 4719c462a49c55ac6e54f0572a31b332e9f0cd1d..a03961b9a1ebceb884f8b5154955dac801aabb59 100644 (file)
@@ -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