[Python-Dev] Make the stable API-ABI usable

Serhiy Storchaka storchaka at gmail.com
Sat Nov 18 02:30:06 EST 2017

18.11.17 03:05, Victor Stinner пише:
> tl; dr I propose to extend the existing "stable API" to make it almost
> as complete as the current API. For example, add back
> PyTuple_GET_ITEM() to be stable API, but it becomes a function call
> rather than a macro. The final question is if it's not too late to
> iterate on an implementation of this idea for Python 3.7? Knowing that
> the stable API doesn't affect the "current API" at all, since the "new
> C API" (extended stable API) would only be accessible using an
> *opt-in* flag.

There is the PyTuple_GetItem() function. The benefit of using 
PyTuple_GET_ITEM() in tight loops: a) avoid redundant arguments checks; 
b) avoid calling function overhead. Making PyTuple_GET_ITEM() a function 
will destroy the half of the benefit. And this will make the ABI larger.

First at all we need to document all API, what is stable, and in what 
version it had became stable.

Then I would separate three kinds of API physically: limited API, 
extended unstable API, and internal private API, and place their 
declarations in different headers. The headers with internal API should 
not even be visible for third-party developers.

More information about the Python-Dev mailing list