
Hi Victor,
I believe that such breaking changes need to follow the standard PEP 387 procedure.
While your pythoncapi_compat project is nice, I don't think C extension writers will appreciate breaking changes in new releases without the two minor release announcement and warning phase.
This is especially important with the new shorter release cycle.
For the C API, a compiler warning should probably be issued instead of a Python warning.
Cheers.
On 08.09.2021 13:49, Victor Stinner wrote:
Hi,
I converted Py_TYPE() and Py_SIZE() macros to static inline functions in the future Python 3.11. It's a backward incompatible change. For example, "Py_TYPE(obj) = type;" must be replaced with "Py_SET_TYPE(obj, type);".
You can use the upgrade_pythoncapi.py script of my pythoncapi_compat project which does these changes for you: you just have to copy pythoncapi_compat.h to your project. This header file provides new C API functions like Py_NewRef() and Py_SET_TYPE() to old Python versions, Python 2.7-3.11.
=> https://github.com/pythoncapi/pythoncapi_compat
I already converted Py_TYPE() and Py_SIZE() macros in Python 3.10, but it broke too many C extensions and so I had to revert the change. In the meanwhile, I updated many C extensions and created the pythoncapi_compat project. For example, Cython and numpy have been updated to use Py_SET_TYPE() and Py_SET_SIZE(). Mercurial and immutables projects now use pythoncapi_compat.
I'm interested by feedback on my pythoncapi_compat project ;-)
Tell me if you need help to update your project for Python 3.11 C API changes: https://docs.python.org/dev/whatsnew/3.11.html#c-api-changes
Victor
Night gathers, and now my watch begins. It shall not end until my death. _______________________________________________ capi-sig mailing list -- capi-sig@python.org To unsubscribe send an email to capi-sig-leave@python.org https://mail.python.org/mailman3/lists/capi-sig.python.org/ Member address: mal@egenix.com