Le lun. 30 sept. 2019 à 13:45, Nick Coghlan firstname.lastname@example.org a écrit :
I understand that your main motivation to use the Python version number rather than sizeof(PyConfig) is the error message.
No, my main motivation is to create an API that can emit a useful error message on *ALL* version conflicts between an embedding application and the embedded runtime, not just version conflicts involving versions that change the size of the config structs.
The latter option is a good one if all we want to version is the struct itself, but I don't think that's what we really want here: I think we want to version check the entire API/ABI.
IMHO this discussion is going too far away from the PEP 587 goals. The PEP 587 is unrelated to the stable API or the stable ABI.
I suggest to develop a new use case and a new solution to handle this case. The solution can be *very different* than "compare two versions at startup".
For example, we may need a CI to ensure that we don't break the stable ABI: https://pythoncapi.readthedocs.io/stable_abi.html#check-for-abi-changes
Another solution is to write a completely new C API from scratch. For example, HPy ("PyHandle") project proposes to write a new API implemented on top of the existing API: https://github.com/pyhandle/hpy
This project is even developed outside CPython. So the solution can be found *outside* CPython as well.
Victor -- Night gathers, and now my watch begins. It shall not end until my death.