7 #include <pybind11/pybind11.h> 10 #include <pybind11/stl.h> 13 #ifndef BINDER_PYBIND11_TYPE_CASTER 14 #define BINDER_PYBIND11_TYPE_CASTER 22 using std::runtime_error::runtime_error;
24 const char *
what() const noexcept
override {
25 pybind11::gil_scoped_acquire gil;
26 pybind11::function overload = pybind11::get_overload(static_cast<const std::runtime_error *>(
this),
"what");
28 auto o = overload.operator()<pybind11::return_value_policy::reference>();
29 if (pybind11::detail::cast_is_temporary_value_reference<const char *>::value) {
30 static pybind11::detail::overload_caster_t<const char *> caster;
31 return pybind11::detail::cast_ref<const char *>(std::move(o), caster);
33 else return pybind11::detail::cast_safe<const char *>(std::move(o));
35 return runtime_error::what();
42 pybind11::class_<std::runtime_error, std::shared_ptr<std::runtime_error>,
PyCallBack_std_runtime_error, std::exception> cl(M(
"std"),
"runtime_error",
"");
43 cl.def( pybind11::init<const std::string &>(), pybind11::arg(
"__arg") );
45 cl.def( pybind11::init<const char *>(), pybind11::arg(
"") );
47 cl.def( pybind11::init( [](PyCallBack_std_runtime_error
const &o){
return new PyCallBack_std_runtime_error(o); } ) );
48 cl.def( pybind11::init( [](std::runtime_error
const &o){
return new std::runtime_error(o); } ) );
49 cl.def(
"assign", (
class std::runtime_error & (std::runtime_error::*)(
const class std::runtime_error &)) &std::runtime_error::operator=,
"C++: std::runtime_error::operator=(const class std::runtime_error &) --> class std::runtime_error &", pybind11::return_value_policy::automatic, pybind11::arg(
""));
50 cl.def(
"what", (
const char * (std::runtime_error::*)()
const) &std::runtime_error::what,
"C++: std::runtime_error::what() const --> const char *", pybind11::return_value_policy::automatic);
const char * what() const noexceptoverride
PYBIND11_DECLARE_HOLDER_TYPE(T, std::shared_ptr< T >)
PYBIND11_MAKE_OPAQUE(std::shared_ptr< void >)
void bind_std_stdexcept(std::function< pybind11::module &(std::string const &namespace_) > &M)