我试图检查boost::python::tuple中的值是否为none。我有以下代码:
namespace py = boost::python;
py::list ls(inf.Module().attr("data_out"));
for (int i = 0; i < len(ls); i++){
py::tuple tuple = py::extract<py::tuple>(ls[i]);
if (tuple[1] == py::object()){ /* Does not work */
//do other stuff
}
}
这给了我:
TypeError: No registered converter was able to produce a C++ rvalue of type unsigned int from this Python object of type NoneType
有人能帮我吗?