Skip to content

Too many ancestors when inheriting from typing_extensions.TypedDict #9101

@JanEricNitschke

Description

@JanEricNitschke

Bug description

After upgrading to pylint 3.0.0 (Still on python 3.11) i got new warnings from pylint regarding too-many-ancestors.
I have tried to narrow down the issue to a somewhat minimal example below but i really have no idea what the cause is here.
The removal of any of the lines below makes the issue disappear. Order also seems relevant.

"""."""
from typing import Literal

from typing_extensions import TypedDict


class A(TypedDict):
    """."""


B = Literal[1]


class C(TypedDict):
    """."""


D: Literal[2]


class E(TypedDict):
    """."""


F = Literal[3]


class G(TypedDict):
    """."""

Configuration

Default configuration. (No configuration file and no command line options)

Command used

pylint pylint_issue.py

Pylint output

************* Module pylint_issue
pylint_issue.py:8:0: R0901: Too many ancestors (9/7) (too-many-ancestors)
pylint_issue.py:16:0: R0901: Too many ancestors (9/7) (too-many-ancestors)
pylint_issue.py:20:0: R0901: Too many ancestors (9/7) (too-many-ancestors)
pylint_issue.py:29:0: R0901: Too many ancestors (9/7) (too-many-ancestors)

------------------------------------------------------------------
Your code has been rated at 5.56/10 (previous run: 5.56/10, +0.00)

Expected behavior

I would expect no errors to occur, like what happend with pylint 2.17.6

Pylint version

pylint 3.0.0
astroid 3.0.0
Python 3.11.3 (tags/v3.11.3:f3909b8, Apr  4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)]

OS / Environment

Windows 10 Pro 22H2

Additional dependencies

astroid==3.0.0
colorama==0.4.6
dill==0.3.7
isort==5.12.0
mccabe==0.7.0
platformdirs==3.11.0
pylint==3.0.0
tomlkit==0.12.1
typing_extensions==4.8.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions