From c21753191b706bb3c5262454ddcf89ffc92a25d6 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Mon, 9 Jan 2023 06:15:25 -0800 Subject: Update file name in serialize_ast and make sure it's in .gitignore --- .gitignore | 1 + examples/serialize_ast.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 3aaede4..662ae9d 100644 --- a/.gitignore +++ b/.gitignore @@ -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() -- cgit v1.2.1