Commit 40f2fdf6 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

gt_io: Add GT_PICKLE_PROTOCOL module variable

parent e06247f5
...@@ -61,9 +61,12 @@ libgraph_tool_core.IStream.readline = IStream_readline ...@@ -61,9 +61,12 @@ libgraph_tool_core.IStream.readline = IStream_readline
libgraph_tool_core.OStream.write = OStream_write libgraph_tool_core.OStream.write = OStream_write
# define and set the pickler/unpickler functions # define and set the pickler/unpickler functions
GT_PICKLE_PROTOCOL = -1
def pickler(stream, obj): def pickler(stream, obj):
sstream = BytesIO() sstream = BytesIO()
pickle.dump(obj, sstream, -1) pickle.dump(obj, sstream, GT_PICKLE_PROTOCOL)
stream.write(sstream.getvalue()) stream.write(sstream.getvalue())
def unpickler(stream): def unpickler(stream):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment