| 116 | } |
| 117 | |
| 118 | std::string toString(const pybind11::object& obj) { |
| 119 | return pyTry<std::string>( |
| 120 | [&]() -> std::string { |
| 121 | return obj.attr("__str__")().cast<pybind11::str>(); |
| 122 | }, |
| 123 | [&]() { |
| 124 | return fmt::format( |
| 125 | "Fail to get string representation of {}", pyTypeStr(obj)); |
| 126 | }); |
| 127 | } |
| 128 | |
| 129 | std::string pickle(const pybind11::object& obj) { |
| 130 | return pyTry<std::string>([&]() { |
no test coverage detected