On 23. 02. 22 20:15, Victor Stinner wrote:
On Wed, Feb 23, 2022 at 7:11 PM Petr Viktorin <encu...@gmail.com> wrote:
I did realize there's one more issue when converting macros or static
inline functions to regular functions.
Regular functions' bodies aren't guarded by limited API #ifdefs, so if
they are part of the limited API it's easy to forget to think about it
when changing them.
If a macro in the limited API is converted to a regular function, then a
test should be added to ensure the old implementation of the macro (i.e.
what's compiled into stable ABI extensions) still works.

Does it problem really belongs to PEP 670 "Convert macros to functions
in the Python C API", or is it more something for PEP 652 "Maintaining
the Stable ABI"?

PEP 652 is a historical document for Python 3.10. Maybe this should go in the devguide, in a section on how to convert macros/static functions to regular functions?


I don't think that Python 3.11 should keep a copy of Python 3.10
macros: it would increase the maintenance burden, each function would
have 2 implementations (3.11 function and 3.10 macro). Also, there
would be no warranty that the copied 3.10 macros would remain exactly
the same than 3.10 code if someone changes them by mistake directly or
indirectly (by changing code used by this macro, changing a compiler
flag, etc).

Maybe such stable ABI test belongs to an external project building a C
extension with the Python 3.10 limited C API (or an older version) and
then test it on Python 3.11. IMO it's the reliable way to test the
stable ABI: a functional test.

Maybe.
But before we have that kind of test infrastructure, I'm worried that converting limited API macros to regular functions will make it harder to keep the stable ABI working.

_______________________________________________
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/T3HXC3GDPMJA4CONGMLWYNBREIUORMZT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to