On 08. 09. 21 17:21, Victor Stinner wrote:
On Wed, Sep 8, 2021 at 3:49 PM Petr Viktorin <encukou@gmail.com> wrote:
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);".
Why is this needed?
Read the issue for the rationale: https://bugs.python.org/issue39573#msg361513
The reason I asked is that this formally needs SC exception to the backwards compatibility policy. I can apply for the exception if you don't want to, but I'd like to give some good arguments for it -- and while I agree with most of what's in these documents, I don't think making this particular change now is good.
To summarize how I feel: third-party projects.
- CPython and third-party projects can port to Py_SET_TYPE now.
- Experiments (like tagged pointers) can be tried with only the ported
- This is exactly the kind of mandatory code churn that makes Python look bad for users that wrote an extension and want it to work.
- I can see no downside to changing this later, when it brings actual benefit for users.
But, FWIW, I'd support making the change in the 3.11 limited API: if a third-party project changes the Py_LIMITED_API #define, they should be able to modernize their code as well. Same for Py_BUILD_CORE -- we can be stricter in code we control.