mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-45947: Place dict and values pointer at fixed (negative) offset just before GC header. (GH-29879)
* Place __dict__ immediately before GC header for plain Python objects. * Fix up lazy dict creation logic to use managed dict pointers. * Manage values pointer, placing them directly before managed dict pointers. * Convert hint-based load/store attr specialization target managed dict classes. * Specialize LOAD_METHOD for managed dict objects. * Remove unsafe _PyObject_GC_Calloc function. * Remove unsafe _PyObject_GC_Malloc() function. * Add comment explaning use of Py_TPFLAGS_MANAGED_DICT.
This commit is contained in:
parent
c7e7a4b969
commit
8319114fee
19 changed files with 260 additions and 285 deletions
|
@ -5861,6 +5861,7 @@ test_tstate_capi(PyObject *self, PyObject *Py_UNUSED(args))
|
|||
}
|
||||
|
||||
|
||||
static PyObject *negative_dictoffset(PyObject *, PyObject *);
|
||||
static PyObject *test_buildvalue_issue38913(PyObject *, PyObject *);
|
||||
static PyObject *getargs_s_hash_int(PyObject *, PyObject *, PyObject*);
|
||||
|
||||
|
@ -5929,14 +5930,15 @@ static PyMethodDef TestMethods[] = {
|
|||
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__GNUC__)
|
||||
{"test_pep3118_obsolete_write_locks", (PyCFunction)test_pep3118_obsolete_write_locks, METH_NOARGS},
|
||||
#endif
|
||||
{"getbuffer_with_null_view", getbuffer_with_null_view, METH_O},
|
||||
{"PyBuffer_SizeFromFormat", test_PyBuffer_SizeFromFormat, METH_VARARGS},
|
||||
{"test_buildvalue_N", test_buildvalue_N, METH_NOARGS},
|
||||
{"getbuffer_with_null_view", getbuffer_with_null_view, METH_O},
|
||||
{"PyBuffer_SizeFromFormat", test_PyBuffer_SizeFromFormat, METH_VARARGS},
|
||||
{"test_buildvalue_N", test_buildvalue_N, METH_NOARGS},
|
||||
{"negative_dictoffset", negative_dictoffset, METH_NOARGS},
|
||||
{"test_buildvalue_issue38913", test_buildvalue_issue38913, METH_NOARGS},
|
||||
{"get_args", get_args, METH_VARARGS},
|
||||
{"get_args", get_args, METH_VARARGS},
|
||||
{"test_get_statictype_slots", test_get_statictype_slots, METH_NOARGS},
|
||||
{"test_get_type_name", test_get_type_name, METH_NOARGS},
|
||||
{"test_get_type_qualname", test_get_type_qualname, METH_NOARGS},
|
||||
{"test_get_type_qualname", test_get_type_qualname, METH_NOARGS},
|
||||
{"test_type_from_ephemeral_spec", test_type_from_ephemeral_spec, METH_NOARGS},
|
||||
{"get_kwargs", (PyCFunction)(void(*)(void))get_kwargs,
|
||||
METH_VARARGS|METH_KEYWORDS},
|
||||
|
@ -7629,6 +7631,11 @@ PyInit__testcapi(void)
|
|||
return m;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
negative_dictoffset(PyObject *self, PyObject *Py_UNUSED(ignored))
|
||||
{
|
||||
return PyType_FromSpec(&HeapCTypeWithNegativeDict_spec);
|
||||
}
|
||||
|
||||
/* Test the C API exposed when PY_SSIZE_T_CLEAN is not defined */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue