On Tue, 5 Apr 2022 22:54:00 +0200 Victor Stinner firstname.lastname@example.org wrote:
IMO it would be better to keep the HPy design as the long term goal:
- Refer to Python objects with opaque handles
- All structures are opaque (with a few exceptions, like PyType_Spec)
If the HPy design is the long term goal, why not just recommend that people use HPy? And keep the C API for expert users with specific needs that are not accomodated by HPy.
To me, it seems that trying to change the C API to be "like HPy" is creating a lot of work, churn and pain for little gain.
(and, yes, perhaps HPy needs to be funded or supported by the PSF if it doesn't advance fast enough)
It will likely take multiple iterations (Python releases) to reach this goal, and incompatible C API changes may need a PEP (like PEP 674), but IMO it's good to keep this goal in mind.
Otherwise, it's not easy to understand the rationale for changes like https://peps.python.org/pep-0674/ "PEP 674 – Disallow using macros as l-values".