The unpacker currently requires the file to return bytes.
cdef read_from_file(self):
next_bytes = self.file_like_read(
min(self.read_size,
self.max_buffer_size - (self.buf_tail - self.buf_head)
))
if next_bytes:
self.append_buffer(PyBytes_AsString(next_bytes), PyBytes_Size(next_bytes))
else:
self.file_like = None
Is it possible to relax this?
The returned object must of course support the buffer protocol, but beyond that it shouldn't be required to be a bytes type. It could be a memoryview into an in-memory "file". There should be no requirement to copy the data; the unpacker does that anyway.
The unpacker currently requires the file to return bytes.
Is it possible to relax this?
The returned object must of course support the buffer protocol, but beyond that it shouldn't be required to be a
bytestype. It could be a memoryview into an in-memory "file". There should be no requirement to copy the data; the unpacker does that anyway.