mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
GH-91095: Specialize calls to normal Python classes. (GH-99331)
This commit is contained in:
parent
c01da2896a
commit
04492cbc9a
20 changed files with 511 additions and 189 deletions
|
@ -5334,11 +5334,10 @@ _PyDict_NewKeysForClass(void)
|
|||
|
||||
#define CACHED_KEYS(tp) (((PyHeapTypeObject*)tp)->ht_cached_keys)
|
||||
|
||||
static int
|
||||
init_inline_values(PyObject *obj, PyTypeObject *tp)
|
||||
int
|
||||
_PyObject_InitInlineValues(PyObject *obj, PyTypeObject *tp)
|
||||
{
|
||||
assert(tp->tp_flags & Py_TPFLAGS_HEAPTYPE);
|
||||
// assert(type->tp_dictoffset > 0); -- TO DO Update this assert.
|
||||
assert(tp->tp_flags & Py_TPFLAGS_MANAGED_DICT);
|
||||
PyDictKeysObject *keys = CACHED_KEYS(tp);
|
||||
assert(keys != NULL);
|
||||
|
@ -5370,7 +5369,7 @@ _PyObject_InitializeDict(PyObject *obj)
|
|||
}
|
||||
if (tp->tp_flags & Py_TPFLAGS_MANAGED_DICT) {
|
||||
OBJECT_STAT_INC(new_values);
|
||||
return init_inline_values(obj, tp);
|
||||
return _PyObject_InitInlineValues(obj, tp);
|
||||
}
|
||||
PyObject *dict;
|
||||
if (_PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE) && CACHED_KEYS(tp)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue