gh-128262: Allow specialization of calls to classes with __slots__ (GH-128263)

This commit is contained in:
Ken Jin 2024-12-31 12:24:17 +08:00 committed by GitHub
parent dafe7a4463
commit 7ef4907412
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 17 additions and 11 deletions

View file

@ -4572,7 +4572,9 @@
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();
}
assert(tp->tp_flags & Py_TPFLAGS_INLINE_VALUES);
assert(tp->tp_new == PyBaseObject_Type.tp_new);
assert(tp->tp_flags & Py_TPFLAGS_HEAPTYPE);
assert(tp->tp_alloc == PyType_GenericAlloc);
PyHeapTypeObject *cls = (PyHeapTypeObject *)callable_o;
PyFunctionObject *init_func = (PyFunctionObject *)FT_ATOMIC_LOAD_PTR_ACQUIRE(cls->_spec_cache.init);
PyCodeObject *code = (PyCodeObject *)init_func->func_code;
@ -4581,7 +4583,9 @@
JUMP_TO_JUMP_TARGET();
}
STAT_INC(CALL, hit);
PyObject *self_o = _PyType_NewManagedObject(tp);
_PyFrame_SetStackPointer(frame, stack_pointer);
PyObject *self_o = PyType_GenericAlloc(tp, 0);
stack_pointer = _PyFrame_GetStackPointer(frame);
if (self_o == NULL) {
JUMP_TO_ERROR();
}