Deserialize a Python ExtensionType instance
| 53 | |
| 54 | // Deserialize a Python ExtensionType instance |
| 55 | PyObject* DeserializeExtInstance(PyObject* type_class, |
| 56 | std::shared_ptr<DataType> storage_type, |
| 57 | const std::string& serialized_data) { |
| 58 | OwnedRef storage_ref(wrap_data_type(storage_type)); |
| 59 | if (!storage_ref) { |
| 60 | return nullptr; |
| 61 | } |
| 62 | OwnedRef data_ref(PyBytes_FromStringAndSize( |
| 63 | serialized_data.data(), static_cast<Py_ssize_t>(serialized_data.size()))); |
| 64 | if (!data_ref) { |
| 65 | return nullptr; |
| 66 | } |
| 67 | |
| 68 | return cpp_PyObject_CallMethod(type_class, "__arrow_ext_deserialize__", "OO", |
| 69 | storage_ref.obj(), data_ref.obj()); |
| 70 | } |
| 71 | |
| 72 | } // namespace |
| 73 |
no test coverage detected