summaryrefslogtreecommitdiffstats
path: root/Python/gc.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-04-02 10:59:21 (GMT)
committerGitHub <noreply@github.com>2024-04-02 10:59:21 (GMT)
commitc32dc47aca6e8fac152699bc613e015c44ccdba9 (patch)
treee183f7c56ad5e081879c3dd75f7e11887fe7e26c /Python/gc.c
parentc97d3af2391e62ef456ef2365d48ab9b8cdbe27b (diff)
downloadcpython-c32dc47aca6e8fac152699bc613e015c44ccdba9.zip
cpython-c32dc47aca6e8fac152699bc613e015c44ccdba9.tar.gz
cpython-c32dc47aca6e8fac152699bc613e015c44ccdba9.tar.bz2
GH-115776: Embed the values array into the object, for "normal" Python objects. (GH-116115)
Diffstat (limited to 'Python/gc.c')
-rw-r--r--Python/gc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Python/gc.c b/Python/gc.c
index a37c1b1..a487388 100644
--- a/Python/gc.c
+++ b/Python/gc.c
@@ -2031,11 +2031,16 @@ gc_alloc(PyTypeObject *tp, size_t basicsize, size_t presize)
return op;
}
+
PyObject *
_PyObject_GC_New(PyTypeObject *tp)
{
size_t presize = _PyType_PreHeaderSize(tp);
- PyObject *op = gc_alloc(tp, _PyObject_SIZE(tp), presize);
+ size_t size = _PyObject_SIZE(tp);
+ if (_PyType_HasFeature(tp, Py_TPFLAGS_INLINE_VALUES)) {
+ size += _PyInlineValuesSize(tp);
+ }
+ PyObject *op = gc_alloc(tp, size, presize);
if (op == NULL) {
return NULL;
}