[issue15870] PyType_FromSpec should take metaclass as an argument

Petr Viktorin report at bugs.python.org
Tue Oct 5 08:01:42 EDT 2021


Petr Viktorin <encukou at gmail.com> added the comment:

> I am slightly surprised we actually care about static C-definitions?

And I'm surprised that you're surprised :)
AFAIK, supporting dynamically allocated specs/slots was an afterthought. I do agree they should be supported, though! Thanks for filing bpo-45315, and please file any more bugs your find.

But I'd still say that best practice is to make specs static if possible. (And I have some plans to make static specs useful in type checking, since we can assume that types made from the same spec share the memory layout.)


> My patch tries to address the first (the class creator has to take care that this is reasonable for the metaclass).  I had hoped the `slot` mechanism can avoid the API discussion for the second one, but I guess not.

Whoa, I missed the patch completely --  2021 looks too much like 2012, I'm used to patches being old since we use pull requests now, and the conversation turned to slots too quickly... but missing that you mentioned it is completely on me. Sorry!

Do you want to go through with the patch yourself, or should I take over? It still needs:
- opening a PR on GitHub
- tests
- documentation & a What's New entry
- probably separate bug as well, since it doesn't fix this one

----------

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


More information about the Python-bugs-list mailing list