Serialize a Python ExtensionType instance
| 36 | |
| 37 | // Serialize a Python ExtensionType instance |
| 38 | Status SerializeExtInstance(PyObject* type_instance, std::string* out) { |
| 39 | OwnedRef res( |
| 40 | cpp_PyObject_CallMethod(type_instance, "__arrow_ext_serialize__", nullptr)); |
| 41 | if (!res) { |
| 42 | return ConvertPyError(); |
| 43 | } |
| 44 | if (!PyBytes_Check(res.obj())) { |
| 45 | return Status::TypeError( |
| 46 | "__arrow_ext_serialize__ should return bytes object, " |
| 47 | "got ", |
| 48 | internal::PyObject_StdStringRepr(res.obj())); |
| 49 | } |
| 50 | *out = internal::PyBytes_AsStdString(res.obj()); |
| 51 | return Status::OK(); |
| 52 | } |
| 53 | |
| 54 | // Deserialize a Python ExtensionType instance |
| 55 | PyObject* DeserializeExtInstance(PyObject* type_class, |
no test coverage detected