Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed pickle serialization
  • Loading branch information
gsomix committed Apr 5, 2012
1 parent 39e947f commit 6ea66a8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/interfaces/modular/SGBase.i
Expand Up @@ -324,7 +324,7 @@ namespace shogun
unlink(fname);

#ifdef PYTHON3
PyObject* str=PyUnicode_FromStringAndSize(result, len);
PyObject* str=PyBytes_FromStringAndSize(result, len);
#else
PyObject* str=PyString_FromStringAndSize(result, len);
#endif
Expand All @@ -346,8 +346,7 @@ namespace shogun
Py_ssize_t len=0;

#ifdef PYTHON3
len = PyUnicode_GetSize((PyObject*) py_str);
str = PyBytes_AsString(PyUnicode_AsASCIIString(const_cast<PyObject*>(py_str)));
PyBytes_AsStringAndSize(py_str, &str, &len);
#else
PyString_AsStringAndSize(py_str, &str, &len);
#endif
Expand Down

0 comments on commit 6ea66a8

Please sign in to comment.