[issue45531] field "mro" behaves strangely in dataclass

Serhiy Storchaka report at bugs.python.org
Wed Oct 20 06:10:09 EDT 2021


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

In Enum it is just implicitly forbidden:

>>> from enum import *
>>> class A(Enum):
...   mro = 1
...   x = 2
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/serhiy/py/cpython/Lib/enum.py", line 430, in __new__
    raise ValueError('Invalid enum member name: {0}'.format(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Invalid enum member name: mro

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45531>
_______________________________________


More information about the Python-bugs-list mailing list