STINNER Victor <[email protected]> added the comment:
inherit_slots() uses:
/* Inherit tp_vectorcall_offset only if tp_call is not overridden */
if (!type->tp_call) {
COPYSLOT(tp_vectorcall_offset);
}
PyType_Ready() contains the following assertion:
/* Consistency checks for PEP 590:
* - Py_TPFLAGS_METHOD_DESCRIPTOR requires tp_descr_get
* - _Py_TPFLAGS_HAVE_VECTORCALL requires tp_call and
* tp_vectorcall_offset > 0
* To avoid mistakes, we require this before inheriting.
*/
if (type->tp_flags & Py_TPFLAGS_METHOD_DESCRIPTOR) {
_PyObject_ASSERT((PyObject *)type, type->tp_descr_get != NULL);
}
if (type->tp_flags & _Py_TPFLAGS_HAVE_VECTORCALL) {
_PyObject_ASSERT((PyObject *)type, type->tp_vectorcall_offset > 0);
_PyObject_ASSERT((PyObject *)type, type->tp_call != NULL);
}
I understand that tp_vectorcall_offset=0 is fine and the expected value for a
type which doesn't have the flag _Py_TPFLAGS_HAVE_VECTORCALL.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue37250>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com