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
2ebe821e
Commit
2ebe821e
authored
Dec 26, 2012
by
Tiago Peixoto
Browse files
Fix pickling with python3
parent
5d76bbb1
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph_tool/io.py
View file @
2ebe821e
...
...
@@ -63,11 +63,11 @@ libgraph_tool_core.OStream.write = OStream_write
def
pickler
(
stream
,
obj
):
sstream
=
BytesIO
()
pickle
.
dump
(
obj
,
sstream
,
-
1
)
stream
.
write
(
base64
.
b64encode
(
sstream
.
getvalue
()))
stream
.
write
(
base64
.
b64encode
(
sstream
.
getvalue
()
.
encode
(
'ascii'
)
))
def
unpickler
(
stream
):
sstream
=
BytesIO
(
base64
.
b64decode
(
stream
.
read
()))
sstream
=
BytesIO
(
base64
.
b64decode
(
stream
.
read
()
.
encode
(
'ascii'
)
))
return
pickle
.
load
(
sstream
)
libgraph_tool_core
.
set_pickler
(
pickler
)
...
...
Write
Preview
Supports
Markdown
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