On Wed, Jun 3, 2020 at 7:12 AM Mark Shannon wrote:
The size of the C API, as measured by `git grep PyAPI_FUNC | wc -l` has been steadily increasing over the last few releases.
3.5 1237 3.6 1304 3.7 1408 3.8 1478 3.9 1518
For reference the 2.7 branch has "only" 973 functions
It isn't as bad as that. Here I'm only looking at PyAPI_FUNC under Include/. From 3.5 to master the *public* C-API has increased by 71 functions (and the "private"/internal C-API by 189). "Private" is functions starting with "_" and VER TOT PUB + "_" 2.7 932 (752 + 178) 3.5 1181 (846 + 320) 3.6 1247 (851 + 380) 3.7 1350 (875 + 460 + 13 internal) 3.8 1424 (908 + 422 + 79 internal) 3.9 1447 (917 + 403 + 110 internal) m 1443 (917 + 401 + 108 internal) (This does not count changes in the number of macros, which may have gone down...or not.) FWIW, relative to the "cpython" API split that happened in 3.8 (and "internal" in 3.7): VER total Include/*.h Include/cpython/*.h Include/internal/*.h 2.7 932 932 (752 + 178) - - 3.5 1181 1181 (846 + 320) - - 3.6 1247 1247 (851 + 380) - - 3.7 1350 1350 (875 + 460) - 13 (0 + 13) 3.8 1424 1050 (800 + 249) 295 (108 + 173) 79 (0 + 79) 3.9 1447 944 (789 + 153) 393 (128 + 250) 110 (105 + 5) m 1443 941 (789 + 150) 394 (128 + 251) 108 (103 + 5) Here's the "command" I ran: for pat in 'Include/' 'Include/*.h' 'Include/cpython/*.h' 'Include/internal/*.h'; do echo " -- $pat --" echo $(git grep 'PyAPI_FUNC(' -- $pat | wc -l) '('$(git grep 'PyAPI_FUNC(.*) [^_]' -- $pat | wc -l) '+' $(git grep 'PyAPI_FUNC(.*) [_]' -- $pat | wc -l)')' done
Every one of these functions represents a maintenance burden. Removing them is painful and takes a lot of effort, but adding them is done casually, without a PEP or, in many cases, even a review.
I agree with regards to the public C-API, particularly the stable API.
We need to address what to do about the C API in the long term, but for now can we just stop making it larger? Please.
Also, can we remove all the new API functions added in 3.9 before the release and it is too late?
In 3.9 we have added 9 functions to the public C-API and removed 19 from the "private" C-API. The "internal" C-API grew by 31, but I don't see the point in changing any of those. -eric