]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-139871: Optimize small takes in bytearray.take_bytes (GH-141741)
authorCody Maloney <cmaloney@users.noreply.github.com>
Thu, 20 Nov 2025 07:49:05 +0000 (23:49 -0800)
committerGitHub <noreply@github.com>
Thu, 20 Nov 2025 07:49:05 +0000 (08:49 +0100)
commite265ce8a563ba7f91c5ada0592de8cb85622b433
treeb592048222734a3ae4c8766384439e93fc413eec
parenta35c683da55e77c96828fd0421640787337cfc64
gh-139871: Optimize small takes in bytearray.take_bytes (GH-141741)

When less than half the buffer is taken just copy that small part out
rather than doing a big alloc + memmove + big shrink.
Lib/test/test_bytes.py
Objects/bytearrayobject.c