(Posting for the SC.)
The Steering Council is reviewing PEP 820 and we are mostly positive, but we have a few concerns. We realize that the PEP came out of the discussions around PEP 793 (PyModExport: A new entry point for C extension modules) and that it would be convenient to make these changes in Python 3.15 to avoid backward compatibility concerns, but we struggle a little with the motivation for this specific design.
Nested slot tables, in particular, seem like a complex feature with no justification other than “it seems useful”, and perhaps as a generalization of PyType_Slot and PyModuleDef_Slot arrays. The arbitrary limit on nesting, for example: what use-cases do you see for nested slots that make the limit of 5 reasonable?
We’re also a little skeptical about the type safety claims the PEP makes about the new API. While the new API makes it harder to pass the wrong data type to a slot-setting macro (like passing a string to PySlot_FUNC), it does nothing to protect from using the wrong slot-setting macro for a particular slot (like PySlot_STATIC(tp_repr, "<myclass repr>")). The new API is marginally better, but the question is if that’s a good enough reason to add yet another type/module initialization API. Is this really the best API we can come up with, long term, or are we expected to see yet another new API to further improve the type safety?
Lastly, we’re concerned about the new deprecation warnings for existing users of slots that may be setting slots to NULL. We don’t want to flood users with warnings for things that are outside of their control. It would be much better if the deprecation warnings were only issued for uses of the new APIs, unless we’re really confident the only cases that would produce the deprecation warning are, in fact, problematic situations. From the description of the state of affairs that doesn’t seem to be the case.
We would also like to invite extension authors to weigh in on the discussion here, if there are any concerns. While we take objections from third-party authors seriously, we wouldn’t necessarily expect active endorsement from them as this PEP probably doesn’t materially make their lives easier. We just want to make sure that we aren’t making it dramatically harder.
We know time is running out for Python 3.15, but we would appreciate your opinion on these concerns before we decide on this PEP.