Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
314d647b
Commit
314d647b
authored
Oct 16, 2014
by
Tiago Peixoto
Browse files
Fix pickle compatibility issue between python 2 and 3
parent
d529c67e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph_tool/io.py
View file @
314d647b
...
...
@@ -23,6 +23,7 @@ from __future__ import division, absolute_import, print_function
import
pickle
import
base64
import
atexit
import
sys
from
io
import
BytesIO
from
.
import
libgraph_tool_core
...
...
@@ -70,7 +71,9 @@ def pickler(stream, obj):
def
unpickler
(
stream
):
data
=
stream
.
read
()
sstream
=
BytesIO
(
data
)
return
pickle
.
load
(
sstream
)
if
sys
.
version_info
<
(
3
,):
return
pickle
.
load
(
sstream
)
return
pickle
.
load
(
sstream
,
encoding
=
"bytes"
)
libgraph_tool_core
.
set_pickler
(
pickler
)
libgraph_tool_core
.
set_unpickler
(
unpickler
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment