Have a prototype implementation that does that
(see: Add zero-copy conversion of `bytearray` to `bytes` by providing `__bytes__()` - #53 by cmaloney). Doing that means there is a new internal use of PyBytes_FromStringAndSize(NULL, len) + _PyBytes_Resize(); from the other thread the hope was to avoid that and only change bytearray’s internals once by going to PyBytesWriter once it was added.
1 Like