Second order inheritance of dataclasses with default values/init=False
causes E1120 no-value-for-parameter
#10056
Labels
init=False
causes E1120 no-value-for-parameter
#10056
Bug description
If you have two layers of inheritance of dataclasses where the middle class has fields marked as
field(default=<somevalue>, init=False)
, then instantiation of any child classes get marked asE1120 no-value-for-parameter
, with a reference to those fields.Similar issues with dataclasses and default values/
init=False
has been reported before: #7059 #5225Example that cause
E1120
:This yields an error only on the
Child()
callChaging the
id
field inDerived
toid: int = field(default=0)
causes instantiation of bothDerived
andChild
to be marked asE1120
Examples that does not yield
E1120
A
Child
class that inherits fromParent
whereParent
has a default andinit=False
fieldCommand used
pylint --disable=C0114,C0115 testing.py
Disabling
C0114
andC0115
(docstring warnings)Pylint output
Expected behavior
This should not give E1120
Pylint version
OS / Environment
Windows 11
Also tested in Ubuntu in WSL
The text was updated successfully, but these errors were encountered: