diff options
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/object_layout.md | 4 | ||||
-rw-r--r-- | Objects/typeobject.c | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Objects/object_layout.md b/Objects/object_layout.md index 3524094..4a78166 100644 --- a/Objects/object_layout.md +++ b/Objects/object_layout.md @@ -28,6 +28,10 @@ So the pre-header is these two fields: If the object has no physical dictionary, then the ``dict_pointer`` is set to `NULL`. +In 3.13 only objects with no additional data could have inline values. +That is, instances of classes with `tp_basicsize == sizeof(PyObject)`. +In 3.14, any object whose class has `tp_itemsize == 0` can have inline values. +In both versions, the inline values starts `tp_basicsize` bytes after the object. <details> <summary> 3.12 </summary> diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 0d7009a..f74d5122 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -8340,7 +8340,7 @@ type_ready_managed_dict(PyTypeObject *type) return -1; } } - if (type->tp_itemsize == 0 && type->tp_basicsize == sizeof(PyObject)) { + if (type->tp_itemsize == 0) { type->tp_flags |= Py_TPFLAGS_INLINE_VALUES; } return 0; |