Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add __buffer__ and __release_buffer__ methods to builtin types #5179

Open
dchiquito opened this issue Feb 24, 2024 · 0 comments
Open

Add __buffer__ and __release_buffer__ methods to builtin types #5179

dchiquito opened this issue Feb 24, 2024 · 0 comments
Labels
C-compat A discrepancy between RustPython and CPython

Comments

@dchiquito
Copy link
Contributor

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/

@dchiquito dchiquito added the C-compat A discrepancy between RustPython and CPython label Feb 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-compat A discrepancy between RustPython and CPython
Projects
None yet
Development

No branches or pull requests

1 participant