| 181 | } |
| 182 | |
| 183 | Status 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 | |
| 200 | Status PyExtensionType::FromClass(const std::shared_ptr<DataType> storage_type, |
| 201 | const std::string extension_name, PyObject* typ, |
nothing calls this directly
no test coverage detected