classification
Title: keyword module missing async and await keywords
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: ezio.melotti, martin.panter, ncoghlan, rhettinger, terry.reedy, tuxtimo, vstinner, yselivanov
Priority: normal Keywords:

Created on 2016-02-02 02:06 by tuxtimo, last changed 2018-05-15 02:20 by terry.reedy. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1215 closed misha.gavela, 2017-04-21 14:17
Messages (7)
msg259349 - (view) Author: Timo Furrer (tuxtimo) * Date: 2016-02-02 02:06
I had a look at the *Lib/keyword.py* module. It seems like the auto generated *kwlist* is missing the *await* and *async* keywords.
At least according to https://www.python.org/dev/peps/pep-0492/ they are called *keywords*. 

The keyword module generates the *kwlist* from *Python/graminit.c*.
msg259353 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2016-02-02 02:56
`async` and `await` are only keywords in the context of an 'async def' function.  It will be that way until Python 3.7.  That said, I'm not sure what to do about the keywords module.

Nick, Victor, thoughts?
msg259354 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-02-02 03:07
What happened in cases like “with” and “yield”, when these names were turned into reserved keywords depending on a __future__ statement?
msg259771 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2016-02-07 09:19
It shouldn't go into keywords.py until it is actually a keyword.  Keywords is used for many purposes including syntax highlighting and code analysis tools.
msg259779 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-02-07 10:38
To answer my question, it looks like the keywords.py list is automatically generated (by running the script) from Python/graminit.c, in turn generated from Grammar/Grammar. “Yield” and “with” were always listed even when the __future__ statement was needed to enable them (2.2 and 2.5). But currently ASYNC and AWAIT are in Grammar as what I believe are special tokens, rather than normal keywords.

Depending on the purpose of the syntax highlighting or code analysis, it might be better for these to be listed as keywords now, rather than waiting until 3.7.
msg261984 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2016-03-18 18:28
> Depending on the purpose of the syntax highlighting or code analysis,
> it might be better for these to be listed as keywords now, rather than
> waiting until 3.7.

I agree, especially considering that it takes time before syntax highlighters update their keywords list and users update their syntax highlighters.

Would this be doable, considering that the list is generated automatically?  Are there any other downsides in doing it?
msg316611 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-05-15 02:20
This is out-of-date for 3.5 and almost so for 3.6 and not an issue for 3.7.  The PR has been closed.  And I agree with Raymond that keywords.py should not anticipate the future.  All this is aside from the auto-generation issue.
History
Date User Action Args
2018-05-15 02:20:34terry.reedysetstatus: open -> closed

nosy: + terry.reedy
messages: + msg316611

resolution: not a bug -> out of date
stage: resolved
2017-04-21 14:17:02misha.gavelasetpull_requests: + pull_request1357
2017-04-20 18:45:33r.david.murraylinkissue30120 superseder
2016-03-18 18:28:06ezio.melottisetnosy: + ezio.melotti
messages: + msg261984
2016-02-07 10:38:11martin.pantersetmessages: + msg259779
2016-02-07 09:19:05rhettingersetassignee: rhettinger ->
resolution: not a bug
messages: + msg259771
2016-02-03 00:06:36rhettingersetassignee: rhettinger

nosy: + rhettinger
2016-02-02 03:07:54martin.pantersetnosy: + martin.panter
messages: + msg259354
2016-02-02 02:56:11yselivanovsetnosy: + vstinner, yselivanov, ncoghlan
messages: + msg259353
2016-02-02 02:06:40tuxtimosettitle: keyword.py missing async await -> keyword module missing async and await keywords
2016-02-02 02:06:26tuxtimocreate