New submission from Jelle Zijlstra:

The col_offset attribute for ast.AsyncFunctionDef objects points to the "def" 
keyword, not to the "async" keyword that actually starts the node.

Test case:

In [18]: code = 'async def f(): pass'

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

In [20]: tree.body[0]
Out[20]: <_ast.AsyncFunctionDef at 0x7f5cb6a58f60>

In [21]: tree.body[0].col_offset
Out[21]: 6

----------
components: Library (Lib)
messages: 284978
nosy: Jelle Zijlstra
priority: normal
severity: normal
status: open
title: col_offset for AsyncFunctionDef AST nodes is wrong
versions: Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29205>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to