[issue41618] [C API] How many slots of static types should be exposed in PyType_GetSlot()

Petr Viktorin report at bugs.python.org
Tue Nov 3 17:26:00 EST 2020


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

> Can we write those info to docs? In case some developer want to exposing slot in future.

Do you mean something like "only expose a slot if you have a reason for exposing it"? That sounds like a tautology.
Where in the docs would this go?

> nb_inserved in PyNumberMethods should be removed?

You mean nb_reserved, right?
It can't be removed; old-style initialization is positional.
But it could be replaced according to PEP387:
- in 3.x, raise a warning if it is not set to NULL (in static types)
- in 3.x+2, throw an error if it is not set to NULL (in static types)
- in 3.x+3 or later, it can be replaced by another slot, if there's something we need to add to PyNumberMethods

----------

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


More information about the Python-bugs-list mailing list