Skip to content

Commit 525ff6c

Browse files
committed
Inherit tp_vectorcall when safe to do so.
1 parent 989a3d7 commit 525ff6c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Objects/typeobject.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5170,6 +5170,11 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base)
51705170
!(type->tp_flags & Py_TPFLAGS_HEAPTYPE))
51715171
{
51725172
type->tp_flags |= _Py_TPFLAGS_HAVE_VECTORCALL;
5173+
/* Also inherit tp_vectorcall if tp_call of the
5174+
* metaclass is type.__call__ */
5175+
if (Py_TYPE(type)->tp_call == PyType_Type.tp_call) {
5176+
type->tp_vectorcall = base->tp_vectorcall;
5177+
}
51735178
}
51745179
COPYSLOT(tp_call);
51755180
}

0 commit comments

Comments
 (0)