Incorrect line numbers for decorated functions
Bug #879945 reported by
Wilfred Hughes
This bug affects 3 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Pyflakes |
New
|
Wishlist
|
Unassigned |
Bug Description
In the code:
def decorator(func):
return func
@decorator
def defined_twice():
pass
@decorator
def defined_twice():
pass
Pyflakes gives the error: twice.py:10: redefinition of function 'defined_twice' from line 5
It ought to be: twice.py:11: redefinition of function 'defined_twice' from line 6
Changed in pyflakes: | |
importance: | Undecided → Wishlist |
To post a comment you must log in.
Why? The Python AST makes the decision that the first line of a function is the first decorator that applies to it. Pyflakes just propagates this information.