@@ -34,17 +34,17 @@ namespace py {
3434
3535Status CallCustomCallback (PyObject* callback, PyObject* elem, PyObject** result);
3636
37- Status DeserializeTuple (std::shared_ptr<Array> array, int32_t start_idx, int32_t stop_idx,
37+ Status DeserializeTuple (std::shared_ptr<Array> array, int64_t start_idx, int64_t stop_idx,
3838 PyObject* base,
3939 const std::vector<std::shared_ptr<Tensor>>& tensors,
4040 PyObject** out);
4141
42- Status DeserializeList (std::shared_ptr<Array> array, int32_t start_idx, int32_t stop_idx,
42+ Status DeserializeList (std::shared_ptr<Array> array, int64_t start_idx, int64_t stop_idx,
4343 PyObject* base,
4444 const std::vector<std::shared_ptr<Tensor>>& tensors,
4545 PyObject** out);
4646
47- Status DeserializeDict (std::shared_ptr<Array> array, int32_t start_idx, int32_t stop_idx,
47+ Status DeserializeDict (std::shared_ptr<Array> array, int64_t start_idx, int64_t stop_idx,
4848 PyObject* base,
4949 const std::vector<std::shared_ptr<Tensor>>& tensors,
5050 PyObject** out) {
@@ -78,13 +78,12 @@ Status DeserializeArray(std::shared_ptr<Array> array, int32_t offset, PyObject*
7878 DCHECK (array);
7979 int32_t index = std::static_pointer_cast<Int32Array>(array)->Value (offset);
8080 RETURN_NOT_OK (py::TensorToNdarray (*tensors[index], base, out));
81- /* Mark the array as immutable. */
82- PyObject* flags = PyObject_GetAttrString (*out, " flags" );
83- DCHECK (flags != NULL ) << " Could not mark Numpy array immutable" ;
81+ // Mark the array as immutable
82+ ScopedRef flags ( PyObject_GetAttrString (*out, " flags" ) );
83+ DCHECK (flags. get () != NULL ) << " Could not mark Numpy array immutable" ;
8484 Py_INCREF (Py_False);
85- int flag_set = PyObject_SetAttrString (flags, " writeable" , Py_False);
85+ int flag_set = PyObject_SetAttrString (flags. get () , " writeable" , Py_False);
8686 DCHECK (flag_set == 0 ) << " Could not mark Numpy array immutable" ;
87- Py_XDECREF (flags);
8887 return Status::OK ();
8988}
9089
@@ -133,7 +132,7 @@ Status GetValue(std::shared_ptr<Array> arr, int32_t index, int32_t type, PyObjec
133132 return DeserializeDict (l->values (), l->value_offset (index),
134133 l->value_offset (index + 1 ), base, tensors, result);
135134 } else {
136- DCHECK (false ) << " error " ;
135+ DCHECK (false ) << " unexpected StructArray type " << s-> type ()-> child ( 0 )-> name () ;
137136 }
138137 }
139138 // We use an Int32Builder here to distinguish the tensor indices from
@@ -142,7 +141,7 @@ Status GetValue(std::shared_ptr<Array> arr, int32_t index, int32_t type, PyObjec
142141 return DeserializeArray (arr, index, base, tensors, result);
143142 }
144143 default :
145- DCHECK (false ) << " union tag not recognized " << type;
144+ DCHECK (false ) << " union tag " << type << " not recognized " ;
146145 }
147146 return Status::OK ();
148147}
@@ -169,14 +168,14 @@ Status GetValue(std::shared_ptr<Array> arr, int32_t index, int32_t type, PyObjec
169168 *out = result.release(); \
170169 return Status::OK();
171170
172- Status DeserializeList (std::shared_ptr<Array> array, int32_t start_idx, int32_t stop_idx,
171+ Status DeserializeList (std::shared_ptr<Array> array, int64_t start_idx, int64_t stop_idx,
173172 PyObject* base,
174173 const std::vector<std::shared_ptr<Tensor>>& tensors,
175174 PyObject** out) {
176175 DESERIALIZE_SEQUENCE (PyList_New, PyList_SET_ITEM)
177176}
178177
179- Status DeserializeTuple (std::shared_ptr<Array> array, int32_t start_idx, int32_t stop_idx,
178+ Status DeserializeTuple (std::shared_ptr<Array> array, int64_t start_idx, int64_t stop_idx,
180179 PyObject* base,
181180 const std::vector<std::shared_ptr<Tensor>>& tensors,
182181 PyObject** out) {
0 commit comments