Skip to content

False positive with default arg values before *args #2481

Closed
@eirnym

Description

@eirnym

Steps to reproduce

  1. run pylint on a file with function below
def fun(param1, param2, param3=True, *args):
    """Pylint false positive

        >>> fun(1, 2)
        (1, 2, True, ())
        >>> fun(1, 2, 3)
        (1, 2, 3, ())
        >>> fun(1, 2, 3, 4)
        (1, 2, 3, (4,))
    """
    return (param1, param2, param3, args)

Current behavior

W1113: Keyword argument before variable positional arguments list in the definition of fun function (keyword-arg-before-vararg)

Expected behavior

different warning if any as variable param3 is not a keyword argument.

pylint --version output

pylint 2.1.1
astroid 2.0.4
Python 3.7.0 (default, Jun 28 2018, 06:05:58) 
[Clang 9.0.0 (clang-900.0.39.2)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions