summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorKen Jin <kenjin@python.org>2024-12-31 04:24:17 (GMT)
committerGitHub <noreply@github.com>2024-12-31 04:24:17 (GMT)
commit7ef49074123511003c8b7f7f3ba2a4e05285e8dc (patch)
tree1719d0d2fd187f79bd1398b9f230bb5a65c9502e /Python/bytecodes.c
parentdafe7a44630aa32bb411cceb45c7b7df725e3fe3 (diff)
downloadcpython-7ef49074123511003c8b7f7f3ba2a4e05285e8dc.zip
cpython-7ef49074123511003c8b7f7f3ba2a4e05285e8dc.tar.gz
cpython-7ef49074123511003c8b7f7f3ba2a4e05285e8dc.tar.bz2
gh-128262: Allow specialization of calls to classes with __slots__ (GH-128263)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 63cf197..602cf7f 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -3765,13 +3765,15 @@ dummy_func(
DEOPT_IF(!PyType_Check(callable_o));
PyTypeObject *tp = (PyTypeObject *)callable_o;
DEOPT_IF(FT_ATOMIC_LOAD_UINT32_RELAXED(tp->tp_version_tag) != type_version);
- 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));
STAT_INC(CALL, hit);
- PyObject *self_o = _PyType_NewManagedObject(tp);
+ PyObject *self_o = PyType_GenericAlloc(tp, 0);
if (self_o == NULL) {
ERROR_NO_POP();
}