Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Doc/library/ast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2155,7 +2155,9 @@ and classes for traversing abstract syntax trees:
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.
This function raises :exc:`SyntaxError` if the parsed source is invalid.
It can also raise :exc:`ValueError`, :exc:`OverflowError` and
:exc:`RecursionError`.

.. warning::
Note that successfully parsing source code into an AST object doesn't
Expand All @@ -2176,6 +2178,10 @@ and classes for traversing abstract syntax trees:
.. versionchanged:: 3.8
Added ``type_comments``, ``mode='func_type'`` and ``feature_version``.

.. versionchanged:: 3.12
Previously, :exc:`ValueError` was raised instead of :exc:`SyntaxError`
when null characters (``\0``) were encountered in *source*.

.. versionchanged:: 3.13
The minimum supported version for ``feature_version`` is now ``(3, 7)``.
The ``optimize`` argument was added.
Expand Down
8 changes: 6 additions & 2 deletions Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,9 @@ are always available. They are listed here in alphabetical order.
``__debug__`` is true), ``1`` (asserts are removed, ``__debug__`` is false)
or ``2`` (docstrings are removed too).

This function raises :exc:`SyntaxError` if the compiled source is invalid,
and :exc:`ValueError` if the source contains null bytes.
This function raises :exc:`SyntaxError` if the compiled source is invalid.
It can also raise :exc:`ValueError`, :exc:`OverflowError` and
:exc:`RecursionError`.

If you want to parse Python code into its AST representation, see
:func:`ast.parse`.
Expand Down Expand Up @@ -371,6 +372,9 @@ are always available. They are listed here in alphabetical order.
``ast.PyCF_ALLOW_TOP_LEVEL_AWAIT`` can now be passed in flags to enable
support for top-level ``await``, ``async for``, and ``async with``.

.. versionchanged:: 3.12
Previously, :exc:`ValueError` was raised instead of :exc:`SyntaxError` when
null characters (``\0``) were encountered in *source*.

.. class:: complex(number=0, /)
complex(string, /)
Expand Down
Loading