Commit 36de5a80 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

Fix graph unpickling bug with Python 2

parent 6b9f07b8
......@@ -94,7 +94,11 @@ public:
std::streamsize read(char* s, std::streamsize n)
{
python::object pbuf = _file.attr("read")(n);
#if (PY_MAJOR_VERSION >= 3)
string buf = python::extract<string>(pbuf.attr("decode")("utf-8"));
#else
string buf = python::extract<string>(pbuf);
#endif
for (size_t i = 0; i < buf.size(); ++i)
s[i] = buf[i];
return buf.size();
......
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