Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Issue with inherited keyword dataclass fields #7623

Closed
giodall opened this issue Oct 14, 2022 · 0 comments · Fixed by pylint-dev/astroid#1899
Closed

[Bug] Issue with inherited keyword dataclass fields #7623

giodall opened this issue Oct 14, 2022 · 0 comments · Fixed by pylint-dev/astroid#1899
Assignees
Labels
dataclasses False Positive 🦟 A message is emitted but nothing is wrong with the code

Comments

@giodall
Copy link

giodall commented Oct 14, 2022

Bug description

this issue seems to be close to #5767, but for inherited dataclasses:

@dataclass
class Parent:
    p1: int = field(kw_only=True, default=0)

@dataclass
class Child(Parent):
    c1: str

Child('')
Child('', p1=1)  # redundant-keyword-arg" : "Argument 'p1' passed by position and keyword in constructor call"
Child(c1='')  # "unexpected-keyword-arg": "Unexpected keyword argument 'c1' in constructor call"
Child(c1='', p1=5)  # "unexpected-keyword-arg": "Unexpected keyword argument 'c1' in constructor call"

Configuration

No response

Command used

pylint a.py

Pylint output

[{
	"code": "redundant-keyword-arg",
	"message": "Argument 'p1' passed by position and keyword in constructor call",
},{
	"code": "unexpected-keyword-arg",
	"message": "Unexpected keyword argument 'c1' in constructor call",
},{
	"code": "unexpected-keyword-arg",
	"message": "Unexpected keyword argument 'c1' in constructor call",
}]

Expected behavior

no errors

Pylint version

pylint 2.15.4
astroid 2.12.11
Python 3.10.0 (v3.10.0:b494f5935c, Oct  4 2021, 14:59:20) [Clang 12.0.5 (clang-1205.0.22.11)]

OS / Environment

No response

Additional dependencies

No response

@giodall giodall added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Oct 14, 2022
@Pierre-Sassoulas Pierre-Sassoulas added False Positive 🦟 A message is emitted but nothing is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling Needs PR This issue is accepted, sufficiently specified and now needs an implementation labels Oct 14, 2022
@clavedeluna clavedeluna removed the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Nov 17, 2022
@DanielNoord DanielNoord self-assigned this Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dataclasses False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants