diff options
author | Shantanu <12621235+hauntsaninja@users.noreply.github.com> | 2024-02-29 11:09:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-29 11:09:09 (GMT) |
commit | bea2795be2c08dde3830f987830414f3f12bc1eb (patch) | |
tree | 9abc3502e77b4bdc658a9334031cc169394f40f5 /Doc | |
parent | 186fa9387669bcba6d3974a99c012c2b2c6fb4ce (diff) | |
download | cpython-bea2795be2c08dde3830f987830414f3f12bc1eb.zip cpython-bea2795be2c08dde3830f987830414f3f12bc1eb.tar.gz cpython-bea2795be2c08dde3830f987830414f3f12bc1eb.tar.bz2 |
gh-115881: Document feature_version limitations (#115980)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/ast.rst | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index d629393..5ed6eb6 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -2183,12 +2183,15 @@ 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 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, 7)``; the highest is ``sys.version_info[0:2]``. + Setting ``feature_version`` to a tuple ``(major, minor)`` will result in + a "best-effort" attempt to parse using that Python version's grammar. + For example, setting ``feature_version=(3, 9)`` will attempt to disallow + parsing of :keyword:`match` statements. + Currently ``major`` must equal to ``3``. The lowest supported version is + ``(3, 7)`` (and this may increase in future Python versions); + the highest is ``sys.version_info[0:2]``. "Best-effort" attempt means there + is no guarantee that the parse (or success of the parse) is the same as + when run on the Python version corresponding to ``feature_version``. If source contains a null character ('\0'), :exc:`ValueError` is raised. |