0

I exposed two classes to python:

BOOST_PYTHON_MODULE(client)
{
class_<Error>("Error")
   .def("GetErrorCode", &Error::GetErrorCode)
   .def("GetDescription", &Error::GetDescription)
   .def("__nonzero__", &Error::operator bool);

class_<Client>("Client")
   .def("Execute", &Client::Execute);
}

Here is declaration of Execute method:

void Client::Execute(boost::python::object callable)
{
    Error e;
    callable(e);
}

Here is my python code:

import client

def on_execute(error):
    print error.GetDescription()

c = client.Client()
c.Execute(on_execute)

This fails with Segmentation fault. Debugger says me that can't convert Error object to python. How to resolve this problem?

sgeorgiev
  • 49
  • 1
  • 3

0 Answers0