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

E1120:no-value-for-parameter false positive when subclass has field(init=False) property #7291

Closed
DetachHead opened this issue Aug 11, 2022 · 0 comments · Fixed by pylint-dev/astroid#1898
Assignees
Labels
dataclasses False Positive 🦟 A message is emitted but nothing is wrong with the code

Comments

@DetachHead
Copy link
Contributor

DetachHead commented Aug 11, 2022

Bug description

import inspect
from dataclasses import dataclass, field


@dataclass
class Foo:
    a: int
    b: str


@dataclass
class Bar(Foo):
    a: int = field(init=False, default=1)
    c: str


a = Bar(b="", c="") # error: No value for argument 'a' in constructor call (E1120:no-value-for-parameter)

print(inspect.signature(Bar.__init__))  # (self, b: str, c: str) -> None
print(a)  # Bar(a=1, b='', c='')

Configuration

No response

Command used

pylint asdf.py

Pylint output

************* Module asdf
asdf.py:17:4: E1120: No value for argument 'a' in constructor call (no-value-for-parameter)

Expected behavior

no error

Pylint version

pylint 2.14.5
astroid 2.11.7
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]

OS / Environment

No response

Additional dependencies

No response

@DetachHead DetachHead added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Aug 11, 2022
@jacobtylerwalls jacobtylerwalls removed the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Aug 20, 2022
@jacobtylerwalls jacobtylerwalls changed the title E1120:no-value-for-parameter false positive when subclass has field property E1120:no-value-for-parameter false positive when subclass has field(init=False) property Aug 20, 2022
@jacobtylerwalls jacobtylerwalls added False Positive 🦟 A message is emitted but nothing is wrong with the code dataclasses Needs PR This issue is accepted, sufficiently specified and now needs an implementation labels Aug 20, 2022
@DanielNoord DanielNoord self-assigned this Dec 7, 2022
@DanielNoord DanielNoord removed the Needs PR This issue is accepted, sufficiently specified and now needs an implementation label 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.

3 participants