Skip to content

Decorators confuse E1120 analysis #259

Closed
@pylint-bot

Description

@pylint-bot

Originally reported by: the mulhern (BitBucket: the_mulhern)


Here's the example:

#!python


def decorator(f):

    def new_func(junk=None):
        f(2, junk=junk)

    return new_func

@decorator
def junk1(param, junk=None):
    print("%s" % junk)

def main():
    junk1(junk=2)

The analysis reports
"No value passed for parameter 'param' in function call (no-value-for-parameter)"
This is incorrect, since the actual function being called is the new_func manufactured
by the decorator, and that function does not require the parameter 'param'.

You can work around this by giving param a default value, (which will never be used).


Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions