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

Method SetInstance

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

Source from the content-addressed store, hash-verified

181}
182
183Status PyExtensionType::SetInstance(PyObject* inst) const {
184 // Check we have the right type
185 PyObject* typ = reinterpret_cast<PyObject*>(Py_TYPE(inst));
186 if (typ != type_class_.obj()) {
187 return Status::TypeError("Unexpected Python ExtensionType class ",
188 internal::PyObject_StdStringRepr(typ), " expected ",
189 internal::PyObject_StdStringRepr(type_class_.obj()));
190 }
191
192 PyObject* wr = PyWeakref_NewRef(inst, nullptr);
193 if (wr == NULL) {
194 return ConvertPyError();
195 }
196 type_instance_.reset(wr);
197 return SerializeExtInstance(inst, &serialized_);
198}
199
200Status PyExtensionType::FromClass(const std::shared_ptr<DataType> storage_type,
201 const std::string extension_name, PyObject* typ,

Callers

nothing calls this directly

Calls 5

PyObject_StdStringReprFunction · 0.85
ConvertPyErrorFunction · 0.85
SerializeExtInstanceFunction · 0.85
TypeErrorFunction · 0.50
resetMethod · 0.45

Tested by

no test coverage detected