PyTypeObject's tp_flags field is defined as an unsigned long. In effect this means that we have only 32 bits we can use for flags. We have already used all 32 of them.
Bits 15 and 16 are reserved for Stackless Python. Since Stackless Python is pining for the fjords, we could recycle those two bits. However that's not going to last long with likely changes necessary for parallelism and performance.
Any change to PyTypeObject breaks both API and ABI, but that's OK because:
- Adding a field or changing the size of a field is a backwards compatible API change.
- The existence of
PyTypeObject is part of the stable ABI, but its layout is not.
The cleanest change, IMO, is to change unsigned long tp_flags to uint64_t tp_flags which gives us another 32 bits, which should last many more years.
PyTypeObject'stp_flagsfield is defined as anunsigned long. In effect this means that we have only 32 bits we can use for flags. We have already used all 32 of them.Bits 15 and 16 are reserved for Stackless Python. Since Stackless Python is pining for the fjords, we could recycle those two bits. However that's not going to last long with likely changes necessary for parallelism and performance.
Any change to
PyTypeObjectbreaks both API and ABI, but that's OK because:PyTypeObjectis part of the stable ABI, but its layout is not.The cleanest change, IMO, is to change
unsigned long tp_flagstouint64_t tp_flagswhich gives us another 32 bits, which should last many more years.