Le lun. 30 sept. 2019 à 00:33, Nick Coghlan <ncogh...@gmail.com> a écrit :
> As noted above, despite what I wrote on BPO, you no longer need to persuade 
> me that the version check is desirable, only that a narrow check on specific 
> struct sizes is preferable to a broad check on the expected API version.

I understand that your main motivation to use the Python version
number rather than sizeof(PyConfig) is the error message.

If we implement support for older PyConfig ("stable ABI"), you will
simply never see this error: it will just work transparently.

IMHO the current error message is good enough:

    if (config->struct_size != sizeof(PyConfig)) {
        return _PyStatus_ERR("unsupported PyConfig structure size "
                             "(Python version mismatch?)");
    }

I wrote a proof-of-concept to check if it would be doable to support
multiple versions (sizes) of PyConfig: it's doable and it's quite easy
to implement, a few lines of code. For example, support Python 3.8
PyConfig in Python 3.9.

--

https://bugs.python.org/issue2506 "Add mechanism to disable
optimizations" (-X noopt) would be good first candidate to modify
PyConfig in Python 3.9: https://github.com/python/cpython/pull/13600

Victor
-- 
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/GOD2HMHTBLSVOGSHMLY3WJLOZTKZPI7L/

Reply via email to