This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brandtbucher
Recipients brandtbucher, eric.smith, freundTech, gvanrossum
Date 2021-04-07.17:48:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1617817736.29.0.54639176859.issue43764@roundup.psfhosted.org>
In-reply-to
Content
> Note that setting compare=False on a dataclass.field already excludes that field from __match_args__...

It appears you did find a genuine bug though! I was surprised by this comment, and after digging a bit deeper into _process_class found that we should be generating these from "field_list", not "flds":

>>> @dataclass(repr=False, eq=False, init=False)
... class X:
...     a: int
...     b: int
...     c: int
... 
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/home/bucher/src/cpython/Lib/dataclasses.py", line 1042, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
  File "/home/bucher/src/cpython/Lib/dataclasses.py", line 1020, in _process_class
    cls.__match_args__ = tuple(f.name for f in flds if f.init)
UnboundLocalError: local variable 'flds' referenced before assignment
History
Date User Action Args
2021-04-07 17:48:56brandtbuchersetrecipients: + brandtbucher, gvanrossum, eric.smith, freundTech
2021-04-07 17:48:56brandtbuchersetmessageid: <1617817736.29.0.54639176859.issue43764@roundup.psfhosted.org>
2021-04-07 17:48:56brandtbucherlinkissue43764 messages
2021-04-07 17:48:56brandtbuchercreate