Skip to content

Commit e0a3c81

Browse files
[3.14] gh-153528: Document mode="func_type" in compile() (GH-153561) (#160481)
(cherry picked from commit 02c5d55) Co-authored-by: Pranav Choudhary <pranav.nstblr@gmail.com>
1 parent 5c81698 commit e0a3c81

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎Doc/builtins/functions.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,10 @@ are always available. They are listed here in alphabetical order.
310310
consists of a single expression, or ``'single'`` if it consists of a single
311311
interactive statement (in the latter case, expression statements that
312312
evaluate to something other than ``None`` will be printed).
313+
It can also be ``'func_type'`` if *source* consists of a
314+
function type signature, for example ``(int) -> str``; see
315+
:func:`ast.parse` for more information. This mode requires passing
316+
:data:`ast.PyCF_ONLY_AST` in *flags*.
313317

314318
The optional arguments *flags* and *dont_inherit* control which
315319
:ref:`compiler options <ast-compiler-flags>` should be activated
@@ -379,6 +383,9 @@ are always available. They are listed here in alphabetical order.
379383
``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable
380384
support for top-level ``await``, ``async for``, and ``async with``.
381385

386+
.. versionchanged:: 3.8
387+
Added support for ``mode='func_type'``.
388+
382389
.. versionchanged:: 3.12
383390
:exc:`SyntaxError` is raised instead of :exc:`ValueError` when null bytes
384391
are encountered in *source*.

0 commit comments

Comments
 (0)