cpython/Objects/clinic
Cody Maloney 732224e113
gh-139871: Add bytearray.take_bytes([n]) to efficiently extract bytes (GH-140128)
Update `bytearray` to contain a `bytes` and provide a zero-copy path to
"extract" the `bytes`. This allows making several code paths more efficient.

This does not move any codepaths to make use of this new API. The documentation
changes include common code patterns which can be made more efficient with
this API.

---

When just changing `bytearray` to contain `bytes` I ran pyperformance on a
`--with-lto --enable-optimizations --with-static-libpython` build and don't see
any major speedups or slowdowns with this; all seems to be in the noise of
my machine (Generally changes under 5% or benchmarks that don't touch
bytes/bytearray).


Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Maurycy Pawłowski-Wieroński <5383+maurycy@users.noreply.github.com>
2025-11-13 13:19:44 +00:00
..
bytearrayobject.c.h gh-139871: Add bytearray.take_bytes([n]) to efficiently extract bytes (GH-140128) 2025-11-13 13:19:44 +00:00
bytesobject.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
classobject.c.h gh-111178: Generate correct signature for most self converters (#128447) 2025-01-20 12:40:18 +01:00
codeobject.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
complexobject.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
descrobject.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
dictobject.c.h gh-111178: Change Argument Clinic signature for @classmethod (#131157) 2025-03-12 17:42:07 +01:00
enumobject.c.h gh-137609: Change names of some positional-only parameters in builtins (GH-137611) 2025-08-25 15:36:06 +03:00
exceptions.c.h gh-111178: Change Argument Clinic signature for METH_O (#130682) 2025-03-11 16:33:36 +01:00
floatobject.c.h gh-111178: Change Argument Clinic signature for @classmethod (#131157) 2025-03-12 17:42:07 +01:00
frameobject.c.h gh-128421: Add locking to most frame object functions (gh-131479) 2025-03-21 11:10:07 -04:00
funcobject.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
interpolationobject.c.h gh-132661: Add default value (of "") for Interpolation.expression (#136441) 2025-07-10 16:27:41 +02:00
listobject.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
longobject.c.h GH-135763: AC: Use `Py_ssize_t(allow_negative=False)` (#138394) 2025-09-02 21:29:05 +01:00
memoryobject.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
moduleobject.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
odictobject.c.h gh-125996: fix thread safety of collections.OrderedDict (#133734) 2025-10-13 22:55:07 +05:30
setobject.c.h gh-132657: Avoid locking in frozenset.__contains__ (#132659) 2025-04-18 20:20:29 +05:30
structseq.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00
tupleobject.c.h gh-111178: Change Argument Clinic signature for METH_O (#130682) 2025-03-11 16:33:36 +01:00
typeobject.c.h gh-111178: Change Argument Clinic signature for METH_O (#130682) 2025-03-11 16:33:36 +01:00
typevarobject.c.h gh-139817: Attribute __qualname__ is added to TypeAliasType (#139919) 2025-10-15 09:08:17 -07:00
unicodeobject.c.h gh-131525: Cache the result of tuple_hash (#131529) 2025-03-27 09:57:06 -04:00