diff options
author | Jeroen Demeyer <J.Demeyer@UGent.be> | 2019-06-24 10:41:05 (GMT) |
---|---|---|
committer | Petr Viktorin <encukou@gmail.com> | 2019-06-24 10:41:05 (GMT) |
commit | a8b27e623d75377aabe50df27e97cab4e81a174a (patch) | |
tree | 91879278e60ec4e8c6a35f2688aa60cdb2a59a8a /Objects | |
parent | 47fbc4e45b35b3111e2d947a66490a43ac21d363 (diff) | |
download | cpython-a8b27e623d75377aabe50df27e97cab4e81a174a.zip cpython-a8b27e623d75377aabe50df27e97cab4e81a174a.tar.gz cpython-a8b27e623d75377aabe50df27e97cab4e81a174a.tar.bz2 |
bpo-36974: inherit tp_vectorcall_offset unconditionally (GH-13858)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/call.c | 2 | ||||
-rw-r--r-- | Objects/typeobject.c | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/Objects/call.c b/Objects/call.c index 8a1ce7f..bde5513 100644 --- a/Objects/call.c +++ b/Objects/call.c @@ -184,7 +184,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 e495251..f814333 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -5153,15 +5153,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; |