bpo-40484: Document compiler flags under AST module (GH-19885) (GH-22758)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com>
(cherry picked from commit 155938907c2b3df71608ddeaa0a43d2ec1f2c699)
Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst
index 755c60f..932f725 100644
--- a/Doc/library/ast.rst
+++ b/Doc/library/ast.rst
@@ -1753,6 +1753,34 @@
Added the *indent* option.
+.. _ast-compiler-flags:
+
+Compiler Flags
+--------------
+
+The following flags may be passed to :func:`compile` in order to change
+effects on the compilation of a program:
+
+.. data:: PyCF_ALLOW_TOP_LEVEL_AWAIT
+
+ Enables support for top-level ``await``, ``async for``, ``async with``
+ and async comprehensions.
+
+ .. versionadded:: 3.8
+
+.. data:: PyCF_ONLY_AST
+
+ Generates and returns an abstract syntax tree instead of returning a
+ compiled code object.
+
+.. data:: PyCF_TYPE_COMMENTS
+
+ Enables support for :pep:`484` and :pep:`526` style type comments
+ (``# type: <type>``, ``# type: ignore <stuff>``).
+
+ .. versionadded:: 3.8
+
+
.. _ast-cli:
Command-Line Usage