Issue29205
Created on 2017-01-08 11:29 by JelleZijlstra, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| issue29205.patch | JelleZijlstra, 2017-01-08 14:03 | patch + tests | review | |
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 4175 | merged | guoci, 2017-10-30 16:38 | |
| Messages (3) | |||
|---|---|---|---|
| msg284978 - (view) | Author: Jelle Zijlstra (JelleZijlstra) * ![]() |
Date: 2017-01-08 11:29 | |
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 |
|||
| msg284981 - (view) | Author: Jelle Zijlstra (JelleZijlstra) * ![]() |
Date: 2017-01-08 11:35 | |
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 |
|||
| msg330186 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * ![]() |
Date: 2018-11-21 08:50 | |
Is this issue fixed? Are backports needed? I can't reproduce the issue on master and 3.7, but can reproduce it on 3.6. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:41 | admin | set | github: 73391 |
| 2019-03-04 17:18:12 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2018-11-21 08:50:33 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka, benjamin.peterson messages:
+ msg330186 |
| 2017-10-30 16:38:34 | guoci | set | stage: patch review pull_requests: + pull_request4144 |
| 2017-01-08 14:03:48 | JelleZijlstra | set | keywords:
+ patch files: + issue29205.patch |
| 2017-01-08 11:35:30 | JelleZijlstra | set | messages: + msg284981 |
| 2017-01-08 11:29:20 | JelleZijlstra | create | |
