◐ Shell
clean mode source ↗

Message 396829 - Python tracker

In inherit_slots() in Objects/typeobject.c, Py_TPFLAGS_HAVE_VECTORCALL inheritance depends on if the base type is a heap type or not. This aligns with PEP 590[1]:

  Heap types never inherit the vectorcall protocol because that
  would not be safe (heap types can be changed dynamically).

AFAICS, inherit_slots() should now use Py_TPFLAGS_IMMUTABLETYPE to decide if Py_TPFLAGS_HAVE_VECTORCALL can be inherited, and the PEP should be updated.


- [1] https://www.python.org/dev/peps/pep-0590/#subclassing