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

Incorrect "Too many positional arguments" when using typing.overload methods #3170

Closed
chadrik opened this issue Oct 7, 2019 · 1 comment
Closed
Labels

Comments

@chadrik
Copy link

chadrik commented Oct 7, 2019

Steps to reproduce

Create a file:

from typing import overload

class A:
    @classmethod
    @overload
    def foo(cls, arg1):
        pass

    @classmethod
    @overload
    def foo(cls, arg1, arg2):
        pass

    @classmethod
    def foo(cls, arg1, arg2=None):
        pass


A.foo(1, 2)


class B:
    @overload
    def foo(self, arg1):
        pass

    @overload
    def foo(self, arg1, arg2):
        pass

    def foo(self, arg1, arg2=None):
        pass


B().foo(1, 2)

Yes, this is a legitimate use of overloads.

Current behavior

Output:

overload_test.py:20:0: E1121: Too many positional arguments for classmethod call (too-many-function-args)
overload_test.py:36:0: E1121: Too many positional arguments for method call (too-many-function-args)

Expected behavior

overload methods should be ignored when determining the function's signature.

pylint --version output

pylint 2.4.2
astroid 2.3.1
Python 3.7.3 (default, Jun 19 2019, 07:40:15) 
[Clang 10.0.0 (clang-1000.11.45.5)]
@PCManticore PCManticore added this to the Next minor release milestone Oct 9, 2019
@PCManticore
Copy link
Contributor

Thanks for opening an issue, makes sense.

@PCManticore PCManticore modified the milestones: Next minor release, Next bug fix release Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants