[issue29205] col_offset for AsyncFunctionDef AST nodes is wrong

Jelle Zijlstra report at bugs.python.org
Sun Jan 8 06:29:20 EST 2017


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 <report at bugs.python.org>
<http://bugs.python.org/issue29205>
_______________________________________


More information about the Python-bugs-list mailing list