New submission from Pablo Galindo Salgado <pablog...@gmail.com>:

If PyCF_ALLOW_TOP_LEVEL_AWAIT is set this code is valid:

def f():
   await foo

And this should raise a "SyntaxError: 'await' outside async function". The 
reason is that the PyCF_ALLOW_TOP_LEVEL_AWAIT is global in the compiler and 
affects everything without checking if the current code being compiled is 
actually in the TOP level or not.

----------
components: asyncio
messages: 364216
nosy: asvetlov, pablogsal, yselivanov
priority: normal
severity: normal
status: open
title: await is valid in non async functions if PyCF_ALLOW_TOP_LEVEL_AWAIT is 
set
type: behavior
versions: Python 3.8, Python 3.9

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

Reply via email to