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

Skip to content

Commit 7181727

Browse files
authored
[3.11] gh-115881: Document feature_version limitations (#115980) (#116174)
1 parent f1d08c2 commit 7181727

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
@@ -2038,12 +2038,15 @@ and classes for traversing abstract syntax trees:
20382038
modified to correspond to :pep:`484` "signature type comments",
20392039
e.g. ``(str, int) -> List[str]``.
20402040

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

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

0 commit comments

Comments
 (0)
0