Le 11/02/2020 à 10:39, Petr Viktorin a écrit :
On 2020-02-07 02:37, Victor Stinner wrote:
Hi,
I pushed a few changes to hide even more implementation details from the limited C API of CPython. See "Changes in the limited C API" documentation at:
https://docs.python.org/dev/whatsnew/3.9.html#build-and-c-api-changes
I'm interesting to get your feedback on such changes.
The limited API is the PEP 384 stable ABI. Breaking it breaks the explicit promise that its functions will be available in any later Python 3.x.
For example, one of your reasons says "these macros didn’t work with the limited API which cannot access PyThreadState.recursion_depth field." That's false: the macro was part of the limited API, so it needs to continue to work. Making PyThreadState fully opaque would be great, yes, but it can't be done in the limited API which included a public macro that touches the internals.
Maybe it is time to start working on the 4.x stable ABI, and do breaking changes there? IMO it would make more sense to start early than to design the whole thing inside the 4.0 development period, anyway.
This sounds like a good idea to me. The current stable ABI was designed "in the dark" and it was exercised only very late, meaning there are probably lots of tiny decisions that appear now to be undesirable. Designing a new "stable ABI" would allow learning from the mistakes made.
Regards
Antoine.