mirror of
https://github.com/python/cpython.git
synced 2025-08-05 01:18:26 +00:00

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.
2 lines
91 B
ReStructuredText
2 lines
91 B
ReStructuredText
Enum: raise :exc:`TypeError` if ``super().__new__()`` is called from a
|
|
custom ``__new__``.
|