diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | examples/serialize_ast.py | 5 |
2 files changed, 4 insertions, 2 deletions
@@ -16,3 +16,4 @@ utils/z.c *.egg-info *.swp .DS_Store +ast.pickle diff --git a/examples/serialize_ast.py b/examples/serialize_ast.py index cc6d60a..af69b5f 100644 --- a/examples/serialize_ast.py +++ b/examples/serialize_ast.py @@ -24,11 +24,12 @@ void func(void) if __name__ == '__main__': parser = c_parser.CParser() ast = parser.parse(text) + dump_filename = 'ast.pickle' - with open('ast', 'wb') as f: + with open(dump_filename, 'wb') as f: pickle.dump(ast, f, protocol=pickle.HIGHEST_PROTOCOL) # Deserialize. - with open('ast', 'rb') as f: + with open(dump_filename, 'rb') as f: ast = pickle.load(f) ast.show() |