Closed
Description
Feature
bytes
object is immutable, so constructing a new bytes
object from another bytes
object doesn't need copying.
However, PyBytes
and PyByteArray
share PyBytesInner
implementation, causing an unnecessary copying of immutable data.
CPython:
>>> b = b'foo'
>>> bytes(b) is b
True
RustPython:
>>> b = b'foo'
>>> bytes(b) is b
False
Python Documentation
https://docs.python.org/3/library/stdtypes.html#bytes-objects