You’re already on top of most of the details, it’s just the labelling and the wheel/so tags we’re debating.
So my complete proposal is that we define abi4 with all the technical changes needed to support free-threaded builds and future forwards+backwards compatible expansion, implement it in 3.15 in all build configurations, freeze abi3 and only keep it in in build configurations where it works (i.e. not free-threaded), marked as deprecated and discouraged until the release we have to completely drop it.[1] Defining Py_LIMITED_API omits all non-abi4 members from the headers, with essential fallbacks[2] for Py_LIMITED_API<0x04000000. Existing abi3 releases continue to work everywhere they would work already, and new releases can be made using abi3 by package developers who refuse to update their code, and those who will update can fix compiler errors until they fit into abi4 (perhaps involving their own #if Py_LIMITED_API+0<0x04000000 checks, depending on which versions they care to support).
I’ll admit, this only really makes sense if we think free-threaded is inevitable. The SC sure sounds that way, so I think it’s responsible for us to assume it will be and we have to provide a reasonable way for package developers to handle it - hence, people who want to support it have to make code changes anyway (and for far more complicated problems than compiler errors!), and so migrating them to abi4 is a simplifying step. But if those code changes aren’t needed (because we give up on free-threading) then migrating to abi4 is pure pain, and I wouldn’t support it.
In any case, I don’t support compiler flags or ABI flags that indicate “I never rely on the members or shape of PyObject”. Either it’s allowed by the ABI or it isn’t, and if it isn’t allowed then it should just be a new ABI so we can properly change what we need to change to enable it. We can even require use of a new module export with a new ABI, which greatly simplifies that whole exercise[3].
Because we’re actually changing
PyObject, not merely making it opaque. ↩︎Such as
ob_refcntand friends. ↩︎To me, the challenge there is the migration process, not the technicalities of how it looks/works. No matter how perfect or imperfect, people won’t want to change to it, so we need to offer a better reason than “we assumed you wrote bad code before”. ↩︎
