Skip to content

no-member false positive from NewType #3162

Open
@jordan-schneider

Description

@jordan-schneider

This is a weird interaction between the typing library and pylint, so I'm not sure if this is the right place to file the bug, but here goes.

Steps to reproduce

from typing import NewType


class A:
    def __init__(self, value: int):
        self.value = value

a = A(5)
a.value  # no no-member error

B = NewType("B", A)

b = B(a)
b.value  # Instance of 'B' has no 'value' memberpylint(no-member)

Current behavior

Pylint flags a no-member error when accessing members of objects with a NewType class.

Expected behavior

Pylint flags no errors.

pylint --version output

pylint 2.4.2
astroid 2.3.1
Python 3.7.4 (default, Sep 20 2019, 11:46:08)
[GCC 8.3.0]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions