Skip to content

False positive: arguments-differ for __init_subclass__ in generic #8919

@ShadowLNC

Description

@ShadowLNC

Bug description

from typing import Generic, TypeVar


T = TypeVar("T")


class Testing(Generic[T]):  # pylint: disable=too-few-public-methods
    """Placeholder."""

    def __init_subclass__(cls, /, **kwargs: Any) -> None:
        """Placeholder."""
        super().__init_subclass__(**kwargs)

Configuration

No response

Command used

pylint file.py

Pylint output

************* Module file
file.py:10:4: W0221: Variadics removed in overriding 'Testing.__init_subclass__' method (arguments-differ)

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

Expected behavior

I believe this is a false positive.

When I don't inherit from Generic[T], the error goes away.

Pylint version

pylint 2.17.5
astroid 2.15.6
Python 3.11.1 (v3.11.1:a7a450f84a, Dec  6 2022, 15:24:06) [Clang 13.0.0 (clang-1300.0.29.30)]

OS / Environment

MacOS Ventura 13.5

Additional dependencies

No response

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions