I just posted a revised version of PEP 688, which now proposes a Python-level API for the buffer protocol, adding the new
__release_buffer__ dunders. This allows for buffer protocol support in the type system, and also allows Python classes to implement the buffer protocol.
The previous discussion was here: PEP 688: Making the buffer protocol accessible in Python
Possible topics of discussion:
- The PEP still proposes removing the special case where “bytes” is supposed to also mean “bytearray” and “memoryview” in annotations. This proposal got some pushback in the previous thread.
- Does the interaction between the C buffer API and the proposed Python API make sense?
- A few opportunities for bikeshedding: where should the
BufferABC live, what should the new special methods be called, should we add any other related useful tools to the standard library?