diff options
Diffstat (limited to 'examples/serialize_ast.py')
-rw-r--r-- | examples/serialize_ast.py | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/examples/serialize_ast.py b/examples/serialize_ast.py index 8669a0a..cc6d60a 100644 --- a/examples/serialize_ast.py +++ b/examples/serialize_ast.py @@ -25,13 +25,8 @@ if __name__ == '__main__': parser = c_parser.CParser() ast = parser.parse(text) - # Since AST nodes use __slots__ for faster attribute access and - # space saving, it needs Pickle's protocol version >= 2. - # The default version is 3 for python 3.x and 1 for python 2.7. - # You can always select the highest available protocol with the -1 argument. - with open('ast', 'wb') as f: - pickle.dump(ast, f, protocol=-1) + pickle.dump(ast, f, protocol=pickle.HIGHEST_PROTOCOL) # Deserialize. with open('ast', 'rb') as f: |