| 20 | |
| 21 | template <typename T> |
| 22 | T checked_cast(const py::object &obj, const std::string &field, |
| 23 | const std::string &expected_type) { |
| 24 | try { |
| 25 | return obj.cast<T>(); |
| 26 | } catch (const py::cast_error &e) { |
| 27 | std::string actual_type = std::string(py::str(py::type::of(obj))); |
| 28 | std::string msg = "Field '" + field + "': expected " + expected_type + |
| 29 | ", got " + actual_type; |
| 30 | throw py::type_error(msg); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | void ZVecPyDoc::Initialize(pybind11::module_ &m) { |
| 35 | bind_doc_operator(m); |
nothing calls this directly
no outgoing calls
no test coverage detected