diff options
author | Batuhan Taskaya <batuhanosmantaskaya@gmail.com> | 2020-06-28 01:11:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-28 01:11:43 (GMT) |
commit | 8df1016e2ef8c0a9f4d15bf7894c284295c99d9f (patch) | |
tree | 6d5798f78d6d39d903bd0fb95ded41b6e47fddfe /Doc | |
parent | 60eb9f1ab59a59ddf81d3da3513cfa3251169b5c (diff) | |
download | cpython-8df1016e2ef8c0a9f4d15bf7894c284295c99d9f.zip cpython-8df1016e2ef8c0a9f4d15bf7894c284295c99d9f.tar.gz cpython-8df1016e2ef8c0a9f4d15bf7894c284295c99d9f.tar.bz2 |
bpo-38870: Extend subject of ast.unparse warnings (GH-21053)
- 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 recursive unparsing aspect of ast.unparse
Diffstat (limited to 'Doc')
-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 |