diff options
author | Alex Xu <alex_y_xu@yahoo.ca> | 2014-05-02 10:32:16 -0400 |
---|---|---|
committer | Alex Xu <alex_y_xu@yahoo.ca> | 2014-05-02 10:32:16 -0400 |
commit | 2e9bfa707b33f7e371088b66e75f4e76f90ebcee (patch) | |
tree | 08261187323f5ae2e72ce178acd5df5af1701f5e /ast2json/ast2json.py | |
parent | e417662dce5cae2e95ef98ee38baa8f53a02b9d5 (diff) | |
download | html5ks-2e9bfa707b33f7e371088b66e75f4e76f90ebcee.tar.xz html5ks-2e9bfa707b33f7e371088b66e75f4e76f90ebcee.zip |
new image system
Diffstat (limited to 'ast2json/ast2json.py')
-rw-r--r-- | ast2json/ast2json.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ast2json/ast2json.py b/ast2json/ast2json.py index 3460969..23b6f04 100644 --- a/ast2json/ast2json.py +++ b/ast2json/ast2json.py @@ -25,7 +25,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from _ast import AST -from ast import parse +from ast import parse, PyCF_ONLY_AST def ast2json(node): @@ -40,8 +40,8 @@ def ast2json(node): return to_return -def str2json(string): - return ast2json(parse(string)) +def str2json(string, mode='exec'): + return ast2json(compile(string, '<unknown>', mode, PyCF_ONLY_AST)) def get_value(attr_value): |