mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[3.9] bpo-38870: Extend subject of ast.unparse warnings (GH-21053) (GH-21191)
- Mention that some compiler optimizations might not roundtrip
exactly (such as constant tuples and frozensets).
- Add a warning about it might raise RecursionError on very
complex expressions due to the recursive unparsing aspect of ast.unparse
(cherry picked from commit 8df1016
)
This commit is contained in:
parent
6803ff28f8
commit
6e39999a24
1 changed files with 6 additions and 1 deletions
|
@ -1553,7 +1553,12 @@ and classes for traversing abstract syntax trees:
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
The produced code string will not necessarily be equal to the original
|
The produced code string will not necessarily be equal to the original
|
||||||
code that generated the :class:`ast.AST` object.
|
code that generated the :class:`ast.AST` object (without any compiler
|
||||||
|
optimizations, such as constant tuples/frozensets).
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
Trying to unparse a highly complex expression would result with
|
||||||
|
:exc:`RecursionError`.
|
||||||
|
|
||||||
.. versionadded:: 3.9
|
.. versionadded:: 3.9
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue