On Fri, 21 Dec 2018 at 17:25, Carl Shapiro <carl.shapiro@gmail.com> wrote:
I am curious if you could elaborate on what aspect of the limited API you are referring to in these statements, especially regarding maintenance. Are you concerned about the effort to leave that in macro in the API headers, or some other maintenance cost beyond maintaining the macro?
As originally implemented, the limited API was defined as a collection of "#ifndef ..." macros in the existing rich API header files, so by default, any new API declarations would end up in the limited API, even if they didn't belong there. Since our CI suite wasn't set up to detect and prevent stable ABI violations (and still isn't), we unfortunately haven't been maintaining the stable ABI properly.
However, Victor recently went through and rearranged the C header files such that there are 3 different include directories:
- https://github.com/python/cpython/tree/master/Include -> the limited API/stable ABI
- https://github.com/python/cpython/tree/master/Include/cpython -> the full traditional version-specific CPython API/ABI (implicitly included when Py_LIMITED_API is not set)
- https://github.com/python/cpython/tree/master/Include/internal -> CPython runtime internal APIs that even the standard library's extension modules shouldn't be using
This makes the stable ABI a lot easier to maintain, since we only need to remember two guidelines:
- unless we're explicitly intending to expand the stable ABI, new C function declarations go into "Include/cpython"
- if a change does get made directly in an "Include/*.h" file, then it needs a #ifdef guard specifying the version of the stable ABI where it first appeared
There are probably some updates that should be made to PEP 7 and/or the developer's guide around this...
Cheers, Nick.
-- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia