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 JelleZijlstra
Recipients JelleZijlstra
Date 2017-01-08.11:35:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483875330.77.0.796018892084.issue29205@psf.upfronthosting.co.za>
In-reply-to
Content
The col_offset is actually correct when there is a decorator:

In [26]: code = '@decorator\nasync def f(): pass'

In [27]: tree = ast.parse(code)

In [28]: tree.body[0].col_offset
Out[28]: 0

The same issue appears with async for and async with:

In [31]: code = '@decorator\nasync def f():\n    async for x in y: pass'

In [32]: tree = ast.parse(code)

In [34]: tree.body[0].body[0]
Out[34]: <_ast.AsyncFor at 0x7f5cb6a77198>

In [35]: tree.body[0].body[0].col_offset
Out[35]: 10
History
Date User Action Args
2017-01-08 11:35:30JelleZijlstrasetrecipients: + JelleZijlstra
2017-01-08 11:35:30JelleZijlstrasetmessageid: <1483875330.77.0.796018892084.issue29205@psf.upfronthosting.co.za>
2017-01-08 11:35:30JelleZijlstralinkissue29205 messages
2017-01-08 11:35:30JelleZijlstracreate