4 #include <pybind11/pybind11.h>
53 PyObject* objPtr = pybind11::handle(
obj).ptr();
55 char thisStr[] =
"this";
58 if (!PyObject_HasAttrString(objPtr, thisStr))
61 PyObject* thisAttr = PyObject_GetAttrString(objPtr, thisStr);
73 pybind11::object
const&
obj;
78 throw std::invalid_argument(
"Unable to convert Python type of " + std::string(pybind11::str(
obj.attr(
"__repr__"))) +
" to c++ type of " + std::string(
typeid(T).name()));