mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
bpo-36974: inherit the vectorcall protocol (GH-13498)
This commit is contained in:
parent
0f39c2b191
commit
735e8afa9e
3 changed files with 104 additions and 2 deletions
|
|
@ -5147,6 +5147,17 @@ inherit_slots(PyTypeObject *type, PyTypeObject *base)
|
|||
COPYSLOT(tp_repr);
|
||||
/* tp_hash see tp_richcompare */
|
||||
COPYSLOT(tp_call);
|
||||
/* Inherit tp_vectorcall_offset and _Py_TPFLAGS_HAVE_VECTORCALL if tp_call
|
||||
* was inherited, but only for extension types */
|
||||
if ((base->tp_flags & _Py_TPFLAGS_HAVE_VECTORCALL) &&
|
||||
!(type->tp_flags & _Py_TPFLAGS_HAVE_VECTORCALL) &&
|
||||
!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) &&
|
||||
base->tp_call &&
|
||||
type->tp_call == base->tp_call)
|
||||
{
|
||||
type->tp_vectorcall_offset = base->tp_vectorcall_offset;
|
||||
type->tp_flags |= _Py_TPFLAGS_HAVE_VECTORCALL;
|
||||
}
|
||||
COPYSLOT(tp_str);
|
||||
{
|
||||
/* Copy comparison-related slots only when
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue