diff options
author | Eli Bendersky <eliben@gmail.com> | 2023-01-09 06:15:25 -0800 |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2023-01-09 06:15:25 -0800 |
commit | c21753191b706bb3c5262454ddcf89ffc92a25d6 (patch) | |
tree | 6db4b051d1291f0e289de087bb84c8fce5e8087b | |
parent | 489d208f09e188025f9b231a9cf2d90c05c92fbe (diff) | |
download | pycparser-c21753191b706bb3c5262454ddcf89ffc92a25d6.tar.gz |
Update file name in serialize_ast and make sure it's in .gitignore
-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() |