diff options
author | Guido van Rossum <guido@python.org> | 2019-06-12 00:23:12 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-06-12 00:23:12 (GMT) |
commit | 10b55c1643b512b3a2cae8ab89c53683a13ca43e (patch) | |
tree | 3364d39f7940f01daf84ae0b319a10680059f38b /Doc/library/ast.rst | |
parent | 04856c2193eb72d72c46b57fa08095235d732a73 (diff) | |
download | cpython-10b55c1643b512b3a2cae8ab89c53683a13ca43e.zip cpython-10b55c1643b512b3a2cae8ab89c53683a13ca43e.tar.gz cpython-10b55c1643b512b3a2cae8ab89c53683a13ca43e.tar.bz2 |
bpo-35766: Change format for feature_version to (major, minor) (GH-13992)
(A single int is still allowed, but undocumented.)
https://bugs.python.org/issue35766
Diffstat (limited to 'Doc/library/ast.rst')
-rw-r--r-- | Doc/library/ast.rst | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index 1884bea..1e71838 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -126,7 +126,7 @@ The abstract grammar is currently defined as follows: Apart from the node classes, the :mod:`ast` module defines these utility functions and classes for traversing abstract syntax trees: -.. function:: parse(source, filename='<unknown>', mode='exec', *, type_comments=False, feature_version=-1) +.. function:: parse(source, filename='<unknown>', mode='exec', *, type_comments=False, feature_version=None) Parse the source into an AST node. Equivalent to ``compile(source, filename, mode, ast.PyCF_ONLY_AST)``. @@ -145,11 +145,12 @@ and classes for traversing abstract syntax trees: modified to correspond to :pep:`484` "signature type comments", e.g. ``(str, int) -> List[str]``. - Also, setting ``feature_version`` to the minor version of an - earlier Python 3 version will attempt to parse using that version's - grammar. For example, setting ``feature_version=4`` will allow - the use of ``async`` and ``await`` as variable names. The lowest - supported value is 4; the highest is ``sys.version_info[1]``. + Also, setting ``feature_version`` to a tuple ``(major, minor)`` + will attempt to parse using that Python version's grammar. + Currently ``major`` must equal to ``3``. For example, setting + ``feature_version=(3, 4)`` will allow the use of ``async`` and + ``await`` as variable names. The lowest supported version is + ``(3, 4)``; the highest is ``sys.version_info[0:2]``. .. warning:: It is possible to crash the Python interpreter with a |