Usage of ast.
Chris Angelico
rosuav at gmail.com
Mon Feb 27 09:18:33 EST 2017
On Tue, Feb 28, 2017 at 12:44 AM, Vincent Vande Vyvre
<vincent.vande.vyvre at telenet.be> wrote:
> OK, it's coherent with the secure execution.
>
Yep. Here's a PR to make the message a bit clearer, though:
https://github.com/python/cpython/pull/340
>>> ast.literal_eval("print('hello world')")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/ast.py", line 87, in literal_eval
return _convert(node_or_string)
File "/usr/local/lib/python3.7/ast.py", line 85, in _convert
raise ValueError('%s not allowed in literal' % type(node).__name__)
ValueError: Call not allowed in literal
ChrisA
More information about the Python-list
mailing list