Skip to content

False positive no-member #10472

@maciek-es

Description

@maciek-es

Bug description

The following code makes pylint report no-member for the last line:

from dataclasses import dataclass

@dataclass
class Foo:
    name: str
    val: int

lorem = (Foo(name="lorem", val=0), 0)
ipsum = (Foo(name="ipsum", val=1), 1)
dolor = (Foo(name="dolor", val=2), 2)

names = [sth.name for sth, _ in [lorem, ipsum, dolor]]

Command used

pylint

Pylint output

pyt.py:14:9: E1101: Instance of 'tuple' has no 'name' member (no-member)

Expected behavior

No error is raised

Pylint version

pylint 3.3.7
astroid 3.3.10
Python 3.10.12 (main, May 27 2025, 17:12:29) [GCC 11.4.0]

OS / Environment

Ubuntu 22

Metadata

Metadata

Assignees

No one assigned

    Labels

    False Positive 🦟A message is emitted but nothing is wrong with the codeNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions