SIGN IN SIGN UP
python / cpython UNCLAIMED

The Python programming language

0 0 0 Python

gh-135573: Make pickled lists, sets and dicts a tiny bit smaller (GH-144162)

Ensure that APPENDS and SETITEMS are never used for a batch of size 1.
Ensure that ADDITEMS and SETITEMS are never used for a batch of size 0.

This harmonizes the C implementation with the Python implementation
which already guarantees this and makes a pickle a tiny bit smaller
with a tiny chance (about 0.1%).

Saves 1 byte for list and dict with size 1001, 2001, ...
Saves 2 bytes for set and dict with size 1000, 2000, ...
S
Serhiy Storchaka committed
7ac0868708f342b8990404174a4d200105a4f728
Parent: 9e8fa2d
Committed by GitHub <noreply@github.com> on 2/18/2026, 11:20:31 AM