]> granicus.if.org Git - python/commitdiff
Closes #22525: clarify documentation for ast.literal_eval().
authorGeorg Brandl <georg@python.org>
Wed, 5 Nov 2014 19:20:28 +0000 (20:20 +0100)
committerGeorg Brandl <georg@python.org>
Wed, 5 Nov 2014 19:20:28 +0000 (20:20 +0100)
Doc/library/ast.rst

index 8adc88f7da4fd66a70ccad6f9c0668af3230e7bc..cf0c32e463fee5abef26810120bffe319a323e32 100644 (file)
@@ -132,12 +132,14 @@ and classes for traversing abstract syntax trees:
 .. function:: literal_eval(node_or_string)
 
    Safely evaluate an expression node or a Unicode or *Latin-1* encoded string
-   containing a Python expression.  The string or node provided may only consist
-   of the following Python literal structures: strings, numbers, tuples, lists,
-   dicts, booleans, and ``None``.
-
-   This can be used for safely evaluating strings containing Python expressions
-   from untrusted sources without the need to parse the values oneself.
+   containing a Python literal or container display.  The string or node
+   provided may only consist of the following Python literal structures:
+   strings, numbers, tuples, lists, dicts, booleans, and ``None``.
+
+   This can be used for safely evaluating strings containing Python values from
+   untrusted sources without the need to parse the values oneself.  It is not
+   capable of evaluating arbitrarily complex expressions, for example involving
+   operators or indexing.
 
 
 .. function:: get_docstring(node, clean=True)