summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Objects')
-rw-r--r--Objects/call.c2
-rw-r--r--Objects/typeobject.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/Objects/call.c b/Objects/call.c
index 578e1b3..1f41f5c 100644
--- a/Objects/call.c
+++ b/Objects/call.c
@@ -176,7 +176,7 @@ PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *kwargs)
/* get vectorcallfunc as in _PyVectorcall_Function, but without
* the _Py_TPFLAGS_HAVE_VECTORCALL check */
Py_ssize_t offset = Py_TYPE(callable)->tp_vectorcall_offset;
- if ((offset <= 0) || (!Py_TYPE(callable)->tp_call)) {
+ if (offset <= 0) {
PyErr_Format(PyExc_TypeError, "'%.200s' object does not support vectorcall",
Py_TYPE(callable)->tp_name);
return NULL;
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 01e95ae..6d94bc9 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -5148,15 +5148,15 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base)
COPYSLOT(tp_repr);
/* tp_hash see tp_richcompare */
{
- /* Inherit tp_vectorcall_offset only if tp_call is not overridden */
- if (!type->tp_call) {
- COPYSLOT(tp_vectorcall_offset);
- }
- /* Inherit_Py_TPFLAGS_HAVE_VECTORCALL for non-heap types
+ /* Always inherit tp_vectorcall_offset to support PyVectorcall_Call().
+ * If _Py_TPFLAGS_HAVE_VECTORCALL is not inherited, then vectorcall
+ * won't be used automatically. */
+ COPYSLOT(tp_vectorcall_offset);
+
+ /* Inherit _Py_TPFLAGS_HAVE_VECTORCALL for non-heap types
* if tp_call is not overridden */
if (!type->tp_call &&
(base->tp_flags & _Py_TPFLAGS_HAVE_VECTORCALL) &&
- !(type->tp_flags & _Py_TPFLAGS_HAVE_VECTORCALL) &&
!(type->tp_flags & Py_TPFLAGS_HEAPTYPE))
{
type->tp_flags |= _Py_TPFLAGS_HAVE_VECTORCALL;