GeezerVison is showing github.com — bpo-39573: Py_TYPE becomes a static inline function by vstinner · Pull Request #26493 · python/cpython
Conversation
vstinner
commented
Jun 2, 2021
•
edited by bedevere-bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Convert the Py_TYPE() and Py_SIZE() macros to static inline
functions. The Py_SET_TYPE() and Py_SET_SIZE() functions must now be
used to set an object type and size.
https://bugs.python.org/issue39573
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
erlend-aasland reacted with heart emoji
Convert the Py_TYPE() and Py_SIZE() macros to static inline
functions. The Py_SET_TYPE() and Py_SET_SIZE() functions must now be
used to set an object type and size.
|
One year ago, I already pushed the same change to Python 3.10, but it broke many projects and so had to be reverted, see: https://bugs.python.org/issue39573#msg370074
Multiple things changed since my latest attempt:
-
Major projects like Cython and numpy have been prepared for this incompatible change
-
I created the https://github.com/pythoncapi/pythoncapi_compat project which is made of two parts:
- pythoncapi_compat.h header file provides Py_SET_TYPE() and Py_SET_TYPE() to old Python versions: it supports Python 2.7-3.11.
- upgrade_pythoncapi.py script automates the migration of existing C extensions to the new API (Py_SET_TYPE, Py_SET_TYPE) without losing support with Python 2.7-3.8.
-
pythoncapi_compat.h header and upgrade_pythoncapi.py script have been used successfully on multiple projects (bitarray, immutables, Mercurial, python-zstandard). These projects now include a copy of pythoncapi_compat.h to support old Python versions.
Note: C extensions implemented with Cython only have to regenerate the C files using Cython, if it's not already done (Cython was fixed one year ago).
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The previous attempt (reverted change) was: #20290
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I prefer to merge such incompatible change early in 3.11 dev cycle to give more test to users to test it. If things go wild again, we can consider to revert it a second time.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|