summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2023-01-09 06:15:25 -0800
committerEli Bendersky <eliben@gmail.com>2023-01-09 06:15:25 -0800
commitc21753191b706bb3c5262454ddcf89ffc92a25d6 (patch)
tree6db4b051d1291f0e289de087bb84c8fce5e8087b
parent489d208f09e188025f9b231a9cf2d90c05c92fbe (diff)
downloadpycparser-c21753191b706bb3c5262454ddcf89ffc92a25d6.tar.gz
Update file name in serialize_ast and make sure it's in .gitignore
-rw-r--r--.gitignore1
-rw-r--r--examples/serialize_ast.py5
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()