MCPcopy Create free account
hub / github.com/apache/arrow / SerializeExtInstance

Function SerializeExtInstance

python/pyarrow/src/arrow/python/extension_type.cc:38–52  ·  view source on GitHub ↗

Serialize a Python ExtensionType instance

Source from the content-addressed store, hash-verified

36
37// Serialize a Python ExtensionType instance
38Status 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
55PyObject* DeserializeExtInstance(PyObject* type_class,

Callers 1

SetInstanceMethod · 0.85

Calls 6

cpp_PyObject_CallMethodFunction · 0.85
ConvertPyErrorFunction · 0.85
PyObject_StdStringReprFunction · 0.85
PyBytes_AsStdStringFunction · 0.85
TypeErrorFunction · 0.50
OKFunction · 0.50

Tested by

no test coverage detected