diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2020-06-28 01:22:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-28 01:22:30 (GMT) |
commit | 6e39999a246a019a356e1befcdfd3d54a52cb7b5 (patch) | |
tree | d115f8a48c6df398c47b651a6a498a4887933e37 | |
parent | 6803ff28f8b9c57ae2442c56e3e5d265f46aea15 (diff) | |
download | cpython-6e39999a246a019a356e1befcdfd3d54a52cb7b5.zip cpython-6e39999a246a019a356e1befcdfd3d54a52cb7b5.tar.gz cpython-6e39999a246a019a356e1befcdfd3d54a52cb7b5.tar.bz2 |
[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)
-rw-r--r-- | Doc/library/ast.rst | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Doc/library/ast.rst b/Doc/library/ast.rst index 6c6ad01..25cb178 100644 --- a/Doc/library/ast.rst +++ b/Doc/library/ast.rst @@ -1553,7 +1553,12 @@ and classes for traversing abstract syntax trees: .. warning:: 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 |