Open broper2 opened 6 months ago
Hi, any update here? Appreciate any insight on this, thanks
Not a positive comment, but as the type hint for read_ipc
says (source: IO[bytes]
), read_ipc
explicitly expects the return value or .read()
being immutable bytes
, rather than mutable bytearray
. Due to the safety issue (must introduce unsafe
at various code blocks, ...) it usually takes nontrivial work and decision choice for rust (compared to duck-typing-oriented language like python) I think.
Checks
Reproducible example
Log output
Issue description
I am trying to pass a custom implementation of python's file-like object to polars
read_ipc
. The implementation of theread
method will return typebytearray
notbytes
. Polars does not seem to be compatible with this return type as it tries to cast immediately topyo3::types::PyBytes
. However, it seems to me that returningbytearray
type from read is in line with python's buffer protocol (see https://docs.python.org/3/glossary.html#term-binary-file and https://docs.python.org/3/glossary.html#term-bytes-like-object).Expected behavior
I would expect polars to fully support python's file-like buffer protocol
Installed versions