8000 [3.12] gh-115881: Document feature_version limitations (#115980) (#11… · python/cpython@2cf68db · GitHub
[go: up one dir, main page]

Skip to content

Commit 2cf68db

Browse files
authored
[3.12] gh-115881: Document feature_version limitations (#115980) (#116173)
1 parent 5f63b73 commit 2cf68db

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Doc/library/ast.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,12 +2178,15 @@ and classes for traversing abstract syntax trees:
21782178
modified to correspond to :pep:`484` "signature type comments",
21792179
e.g. ``(str, int) -> List[str]``.
21802180

2181-
Also, setting ``feature_version`` to a tuple ``(major, minor)``
2182-
will attempt to parse using that Python version's grammar.
2183-
Currently ``major`` must equal to ``3``. For example, setting
2184-
``feature_version=(3, 4)`` will allow the use of ``async`` and
2185-
``await`` as variable names. The lowest supported version is
2186-
``(3, 4)``; the highest is ``sys.version_info[0:2]``.
2181+
Setting ``feature_version`` to a tuple ``(major, minor)`` will result in
2182+
a "best-effort" attempt to parse using that Python version's grammar.
2183+
For example, setting ``feature_version=(3, 9)`` will attempt to disallow
2184+
parsing of :keyword:`match` statements.
2185+
Currently ``major`` must equal to ``3``. The lowest supported version is
2186+
``(3, 4)`` (and this may increase in future Python versions);
2187+
the highest is ``sys.version_info[0:2]``. "Best-effort" attempt means there
2188+
is no guarantee that the parse (or success of the parse) is the same as
2189+
when run on the Python version corresponding to ``feature_version``.
21872190

21882191
If source contains a null character (``\0``), :exc:`ValueError` is raised.
21892192

0 commit comments

Comments
 (0)
0