implement ast module, or a least its `literal_eval`
See original GitHub issueHello,
while trying to import jinja2
for testing purpose, the import of literal_eval
from ast
module from stdlib failed. literal_eval
is a safe eval
which can be used with untrusted source (see https://docs.python.org/3/library/ast.html#ast.literal_eval) and could be useful in the web context.
Would it be possible to implement ast
module, or at least its literal_eval
method?
Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:17 (9 by maintainers)
Top Results From Across the Web
ast — Abstract Syntax Trees — Python 3.11.1 documentation
The ast module helps Python applications to process trees of the Python abstract syntax grammar. The abstract syntax itself might change with each...
Read more >Assistance with Python's ast.literal_eval('a_string')
1 Answer 1 · you cannot use ast.literal_eval because logging.Debug is not a litteral: you ask a value from a module, and that...
Read more >What is ast.literal_eval(node_or_string) in Python?
The ast module (Abstract Syntax Tree) allows us to interact with and modify Python code. ... It may consist of the following Python...
Read more >Rephrase ast.literal_eval() to remove any security warranty
Currently, ast.literal_eval() documentation gives multiple security warranties: Safely evaluate This can be used for safely evaluating ...
Read more >ValueError malformed string when using ast literal eval
It is widely known that using eval() is a potential security risk so the use of ast.literal_eval( ... 2.7 without using the risky...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I hacked together a (mostly) working
literal_eval
frompycopy-ast
and CPython 3.6.https://gist.github.com/gilch/efdd9a1f600cef976be921bb3c5ed421
I am currently working on porting the AST module of the pycopy-lib and RestrictedPython to Brython.