This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gforcada
Recipients gforcada
Date 2018-04-03.05:13:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Given the following code:

class MyClass(object):

    def my_function(self): pass

Parsing it with ast module, the lineno and col_offset of the ast.FunctionDef is reported to be where the decorator starts (i.e. line 3 column 4) rather than where the actual def statement is (i.e. line 4 column 4).

This is due to the decorator that is part of the ast.FunctionDef, but as  there can be multiple decorators (which they don't provide their own lineno and col_offset arguments) and they can span across multiple lines, there is no reliable way to actually know where the actual def statement starts physically.

See this bug report on flake8-builtins plugin (I'm the author) reported by @dhood user on github:
Date User Action Args
2018-04-03 05:13:29gforcadasetrecipients: + gforcada
2018-04-03 05:13:29gforcadasetmessageid: <>
2018-04-03 05:13:29gforcadalinkissue33211 messages
2018-04-03 05:13:28gforcadacreate