The Python AST gives the line number where the function definition starts, which includes the decorator. However, the fault isn't on that line and the user cannot fix the issue by changing that line.
Given a FunctionDef node: node.lineno # where the function definition starts node.lineno + len(node.decorator_list) # where the function name is -- You received this bug notification because you are a member of Divmod- dev, which is the registrant for Pyflakes. https://bugs.launchpad.net/bugs/879945 Title: Incorrect line numbers for decorated functions Status in Pyflakes: New 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 To manage notifications about this bug go to: https://bugs.launchpad.net/pyflakes/+bug/879945/+subscriptions -- Mailing list: https://launchpad.net/~divmod-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~divmod-dev More help : https://help.launchpad.net/ListHelp

