summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/bytearray_add_self.py
blob: 94ae8689fd16ce636ab5bce8b995009dcbe4c7b0 (plain) (blame)
1
2
3
4
5
6
7
8
# add a bytearray to itself
# This is not supported by CPython as of 3.11.18.

b = bytearray(b"123456789")
for _ in range(4):
    c = bytearray(b)  # extra allocation increases chance 'b' has to relocate
    b += b
print(b)