pyflakes icon indicating copy to clipboard operation
pyflakes copied to clipboard

Incorrect line numbers when using function decorators

Open Wilfred opened this issue 13 years ago • 0 comments

def decorator(func):
    return func


@decorator
def defined_twice():
    pass


@decorator
def defined_twice():
    pass

Calling pyflakes on this:

> pyflakes twice.py 
twice.py:10: redefinition of function 'defined_twice' from line 5

Expected it to refer to the function definition, on line 6 and redefined on line 11. The problem is the function name, not the decorator usage so referring to lines 6 and 11 seems more logical.

Wilfred avatar Apr 22 '11 09:04 Wilfred