You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reduce the size of plain Python objects from 8 to 6 machine words. #95245
Currently a plain Python object has the following fields:
values
(managed) __dict__
GC 1
GC 2
refcount
__class__
__weakrefs__
WASTED
The WASTED field is present because, due to alignment, we must allocate a multiple of 2 words.
We can reduce this to 6 by merging the values and __dict__ pointers into one (only one can be valid at any time),
and then moving the __weakrefs__ field into the empty space.
changed the title [-]Reduce the size of plain objects from 8 to 6 machines words.[/-][+]Reduce the size of plain Python objects from 8 to 6 machine words.[/+]on Jul 25, 2022
Activity
[-]Reduce the size of plain objects from 8 to 6 machines words.[/-][+]Reduce the size of plain Python objects from 8 to 6 machine words.[/+]GH-95245: Store object values and dict pointers in single tagged poin…
GH-95245: Move weakreflist into the pre-header. (GH-95996)
GH-95245: Document use of `MANAGED` flags instead of offsets. (GH-96044)
iritkatriel commentedon Sep 10, 2022
Is there anything left to do here?
markshannon commentedon Sep 12, 2022
Nothing more to do.
AA-Turner commentedon Jun 24, 2025
Re-opening per discussion in #135755.
encukou commentedon Jun 24, 2025
There's no documentation about
Py_TPFLAGS_PREHEADER. What's it for? How should users use it?sergey-miryanov commentedon Jun 24, 2025
As I understand it, users are not supposed to use this flag. It is only used for internal purposes.
gh-95245: Document Py_TPFLAGS_PREHEADER (GH-135861)