Message390454
> 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 |
|
Date |
User |
Action |
Args |
2021-04-07 17:48:56 | brandtbucher | set | recipients:
+ brandtbucher, gvanrossum, eric.smith, freundTech |
2021-04-07 17:48:56 | brandtbucher | set | messageid: <1617817736.29.0.54639176859.issue43764@roundup.psfhosted.org> |
2021-04-07 17:48:56 | brandtbucher | link | issue43764 messages |
2021-04-07 17:48:56 | brandtbucher | create | |
|