[issue15870] PyType_FromSpec should take metaclass as an argument
Petr Viktorin
report at bugs.python.org
Fri Sep 24 06:43:25 EDT 2021
Petr Viktorin <encukou at gmail.com> added the comment:
> But at least if it's available as a slot then a module is *able* to use it with limited ABI going backwards. A new function doesn't allow that.
I think you're confusing PyType_Slot with the tp_* members of type structures. If a Py_tp_meta is added, it won't appear in past versions. See the end of Include/typeslots.h.
(Sadly, they're both called "slots".)
> Bases are available both as a slot (Py_tp_bases) and as an argument (PyType_FromSpecWithBases). I don't see why this has to be an either/or proposition. Both can be useful.
I consider Py_tp_bases to be a mistake: it's an extra way of doing things that doesn't add any extra functionality, but is sometimes not correct (and it might not be obvious when it's not correct).
> Either would satisfy my use case.
So let's go for the one that isn't a trap in the other use cases :)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue15870>
_______________________________________
More information about the Python-bugs-list
mailing list