1515# specific language governing permissions and limitations
1616# under the License.
1717
18- from libcpp cimport bool as c_bool, nullptr
19- from libcpp.vector cimport vector as c_vector
2018from cpython.ref cimport PyObject
21- from cython.operator cimport dereference as deref
2219
2320from pyarrow.compat import pickle
2421
25- cdef extern from " arrow/python/api.h" namespace ' arrow::py' :
26-
27- CStatus SerializePythonSequence(
28- PyObject* sequence,
29- shared_ptr[CRecordBatch]* batch_out,
30- c_vector[shared_ptr[CTensor]]* tensors_out)
31-
32- CStatus DeserializePythonSequence(
33- shared_ptr[CRecordBatch] batch,
34- c_vector[shared_ptr[CTensor]] tensors,
35- PyObject* base,
36- PyObject** out)
37-
38- cdef extern from " arrow/python/api.h" namespace ' arrow::py' nogil:
39-
40- cdef CStatus WriteSerializedPythonSequence(
41- shared_ptr[CRecordBatch] batch,
42- c_vector[shared_ptr[CTensor]] tensors,
43- OutputStream* dst)
44-
45- cdef CStatus ReadSerializedPythonSequence(
46- shared_ptr[RandomAccessFile] src,
47- shared_ptr[CRecordBatch]* batch_out,
48- c_vector[shared_ptr[CTensor]]* tensors_out)
49-
50- void set_serialization_callbacks(PyObject* serialize_callback,
51- PyObject* deserialize_callback);
52-
5322def is_named_tuple (cls ):
5423 """ Return True if cls is a namedtuple and False otherwise."""
5524 b = cls .__bases__
@@ -170,7 +139,7 @@ def serialize_sequence(object value, NativeFile sink):
170139 sink.write_handle(& stream)
171140
172141 cdef shared_ptr[CRecordBatch] batch
173- cdef c_vector [shared_ptr[CTensor]] tensors
142+ cdef vector [shared_ptr[CTensor]] tensors
174143
175144 check_status(SerializePythonSequence(< PyObject* > value, & batch, & tensors))
176145
@@ -197,7 +166,7 @@ def deserialize_sequence(NativeFile source, object base):
197166 source.read_handle(& stream)
198167
199168 cdef shared_ptr[CRecordBatch] batch
200- cdef c_vector [shared_ptr[CTensor]] tensors
169+ cdef vector [shared_ptr[CTensor]] tensors
201170
202171 with nogil:
203172 check_status(ReadSerializedPythonSequence(stream, & batch, & tensors))
0 commit comments