[issue43908] array.array should remain immutable: add Py_TPFLAGS_IMMUTABLETYPE flag

Erlend E. Aasland report at bugs.python.org
Thu Jul 1 17:40:21 EDT 2021


Erlend E. Aasland <erlend.aasland at innova.no> added the comment:

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

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43908>
_______________________________________


More information about the Python-bugs-list mailing list