mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
gh-115881: Document feature_version limitations (#115980)
This commit is contained in:
parent
186fa93876
commit
bea2795be2
1 changed files with 9 additions and 6 deletions
|
@ -2183,12 +2183,15 @@ and classes for traversing abstract syntax trees:
|
||||||
modified to correspond to :pep:`484` "signature type comments",
|
modified to correspond to :pep:`484` "signature type comments",
|
||||||
e.g. ``(str, int) -> List[str]``.
|
e.g. ``(str, int) -> List[str]``.
|
||||||
|
|
||||||
Also, setting ``feature_version`` to a tuple ``(major, minor)``
|
Setting ``feature_version`` to a tuple ``(major, minor)`` will result in
|
||||||
will attempt to parse using that Python version's grammar.
|
a "best-effort" attempt to parse using that Python version's grammar.
|
||||||
Currently ``major`` must equal to ``3``. For example, setting
|
For example, setting ``feature_version=(3, 9)`` will attempt to disallow
|
||||||
``feature_version=(3, 4)`` will allow the use of ``async`` and
|
parsing of :keyword:`match` statements.
|
||||||
``await`` as variable names. The lowest supported version is
|
Currently ``major`` must equal to ``3``. The lowest supported version is
|
||||||
``(3, 7)``; the highest is ``sys.version_info[0:2]``.
|
``(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.
|
If source contains a null character ('\0'), :exc:`ValueError` is raised.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue