Skip to content

Commit 83ff92d

Browse files
authored
[3.12] gh-115821: [Enum] better error message for calling super().__new__() (GH-116065)
Add note to not call super().__new__() in docs.
1 parent a85e512 commit 83ff92d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Doc/library/enum.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ Data Types
390390

391391
results in the call ``int('1a', 16)`` and a value of ``17`` for the member.
392392

393+
..note:: When writing a custom ``__new__``, do not use ``super().__new__`` --
394+
call the appropriate ``__new__`` instead.
395+
393396
.. method:: Enum.__repr__(self)
394397

395398
Returns the string used for *repr()* calls. By default, returns the

0 commit comments

Comments
 (0)