I have a requirement to create, but not throw, a python RuntimeError.
I'm using Boost python, the code so far:
static boost::python::object builtins = boost::python::import("builtins");
static boost::python::object object = boost::python::extract<boost::python::object>(builtins.attr("RuntimeError"));
PyObject* pyobj = PyObject_CallMethod(object.ptr(), "__init__", "s", "Test error.");
My understanding is that the second statement gives me the class. And them I'm attempting to call the string constructor on that class in the third statement.
That fails, with nullptr returned.
Any ideas?