Skip to content

Add Buffer.as_buffer_like method. #2925

@kylebarron

Description

@kylebarron

The core Buffer class represents a block of memory in either CPU or GPU memory.

There's no current method on Buffer to expose the memory via the buffer protocol without always forcing a copy. The closest thing is the as_array_like method, which returns an ArrayLike, but there's no way to get a BytesLike from it.

So what I want is

    @abstractmethod
    def as_bytes_like(self) -> collections.abc.Buffer:

(#2814 tracks the unification of BytesLike and collections.abc.Buffer types)

In practice, this means that the obstore integration (#1661) won't need to force a memory copy when uploading data.

ref #1661 (comment), cc @TomAugspurger

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions