mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
gh-128262: Allow specialization of calls to classes with __slots__ (GH-128263)
This commit is contained in:
parent
dafe7a4463
commit
7ef4907412
5 changed files with 17 additions and 11 deletions
8
Python/generated_cases.c.h
generated
8
Python/generated_cases.c.h
generated
|
@ -1048,13 +1048,17 @@
|
|||
DEOPT_IF(!PyType_Check(callable_o), CALL);
|
||||
PyTypeObject *tp = (PyTypeObject *)callable_o;
|
||||
DEOPT_IF(FT_ATOMIC_LOAD_UINT32_RELAXED(tp->tp_version_tag) != type_version, CALL);
|
||||
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;
|
||||
DEOPT_IF(!_PyThreadState_HasStackSpace(tstate, code->co_framesize + _Py_InitCleanup.co_framesize), CALL);
|
||||
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) {
|
||||
goto error;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue