summaryrefslogtreecommitdiffstats
path: root/Doc/library/functions.rst
diff options
context:
space:
mode:
authorMatthias Bussonnier <bussonniermatthias@gmail.com>2019-05-21 20:12:03 (GMT)
committerYury Selivanov <yury@magic.io>2019-05-21 20:12:02 (GMT)
commit565b4f1ac7304d1e690c404ca8316f383ba60862 (patch)
tree193faa5ced2666a1fba1b3715c89946398ccbb12 /Doc/library/functions.rst
parentaa32a7e1116f7aaaef9fec453db910e90ab7b101 (diff)
downloadcpython-565b4f1ac7304d1e690c404ca8316f383ba60862.zip
cpython-565b4f1ac7304d1e690c404ca8316f383ba60862.tar.gz
cpython-565b4f1ac7304d1e690c404ca8316f383ba60862.tar.bz2
bpo-34616: Add PyCF_ALLOW_TOP_LEVEL_AWAIT to allow top-level await (GH-13148)
Co-Authored-By: Yury Selivanov <yury@magic.io>
Diffstat (limited to 'Doc/library/functions.rst')
-rw-r--r--Doc/library/functions.rst10
1 files changed, 10 insertions, 0 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index 613e4f7..1a9a8b5 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -257,6 +257,12 @@ are always available. They are listed here in alphabetical order.
can be found as the :attr:`~__future__._Feature.compiler_flag` attribute on
the :class:`~__future__._Feature` instance in the :mod:`__future__` module.
+ The optional argument *flags* also controls whether the compiled source is
+ allowed to contain top-level ``await``, ``async for`` and ``async with``.
+ When the bit ``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` is set, the return code
+ object has ``CO_COROUTINE`` set in ``co_code``, and can be interactively
+ executed via ``await eval(code_object)``.
+
The argument *optimize* specifies the optimization level of the compiler; the
default value of ``-1`` selects the optimization level of the interpreter as
given by :option:`-O` options. Explicit levels are ``0`` (no optimization;
@@ -290,6 +296,10 @@ are always available. They are listed here in alphabetical order.
Previously, :exc:`TypeError` was raised when null bytes were encountered
in *source*.
+ .. versionadded:: 3.8
+ ``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable
+ support for top-level ``await``, ``async for``, and ``async with``.
+
.. class:: complex([real[, imag]])