Skip to content

Add __buffer__ and __release_buffer__ methods to builtin types #5179

Open
@dchiquito

Description

@dchiquito

Feature

The buffer protocol is mostly intended to provide provide a C API to access the underlying buffers of data structures like bytes, array, and memoryview. In Python 3.12 two new methods, __buffer__ and __release_buffer__, were added to allow subclasses and custom classes to interface with the C API.

As far as I can tell RustPython does not support the C API, but the appropriate builtin types should still have these slots defined.

Python Documentation or reference to CPython source code

https://docs.python.org/3.12/reference/datamodel.html#emulating-buffer-types
https://peps.python.org/pep-0688/

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-compatA discrepancy between RustPython and CPython

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions