diff options
| author | Zheng Luo <vicluo96@gmail.com> | 2019-11-16 12:29:06 -0800 |
|---|---|---|
| committer | Zheng Luo <vicluo96@gmail.com> | 2019-11-16 12:29:06 -0800 |
| commit | 39d7e4f1daad19a50f60256e6e753628e1db205b (patch) | |
| tree | f414d979461a62ff52a978f55e8173a72f8a678a /miasm/core/sembuilder.py | |
| parent | 88b714154312948979488e142726fd18680b6220 (diff) | |
| download | focaccia-miasm-39d7e4f1daad19a50f60256e6e753628e1db205b.tar.gz focaccia-miasm-39d7e4f1daad19a50f60256e6e753628e1db205b.zip | |
sembuilder: more compatible way to construct AST module
Python3.8 changes the signature of ast.Module by adding a
ignore_comment field which breaks this project. ast.parse("")
is a dirty but more compatible way to make it work in both
Python 3.8 and <3.8.
Fixed #1092
Diffstat (limited to 'miasm/core/sembuilder.py')
| -rw-r--r-- | miasm/core/sembuilder.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/miasm/core/sembuilder.py b/miasm/core/sembuilder.py index c51ce608..efd80ce4 100644 --- a/miasm/core/sembuilder.py +++ b/miasm/core/sembuilder.py @@ -336,10 +336,11 @@ class SemBuilder(object): ctx=ast.Load())], ctx=ast.Load()))) - ret = ast.Module([ast.FunctionDef(name=fc_ast.name, - args=fc_ast.args, - body=body, - decorator_list=[])]) + ret = ast.parse('') + ret.body = [ast.FunctionDef(name=fc_ast.name, + args=fc_ast.args, + body=body, + decorator_list=[])] # To display the generated function, use codegen.to_source # codegen: https://github.com/andreif/codegen |