Repository navigation
C API: Use _Py_PACK_VERSION() in Py_LIMITED_API version checks - #161622
Conversation
|
I'm never able to remind the value of hexadecimal version numbers such as |
|
This looks like churn to me -- especially with the pre-3.10 versions. |
|
To me, |
|
I agree that this is a significant readability improvement. I can't read hexadecimals either. |
|
I won't block this. But it's the kind of thing that makes backports annoying. |
|
Can we at least limit this to 3.10+? I have no strong opinion. It is a churn, but hexadecimal versions are less readable and more errorprone. |
Move _Py_PACK_VERSION() from pymacro.h to patchlevel.h.
PR generated with these shell commands on Linux:
HEADERS=$(find Include -name "*.h")
sed -i -e "s#0x030[aA]0000#_Py_PACK_VERSION(3, 10)#g" $HEADERS
sed -i -e "s#0x030[bB]0000#_Py_PACK_VERSION(3, 11)#g" $HEADERS
sed -i -e "s#0x030[cC]0000#_Py_PACK_VERSION(3, 12)#g" $HEADERS
sed -i -e "s#0x030[dD]0000#_Py_PACK_VERSION(3, 13)#g" $HEADERS
sed -i -e "s#0x030[eE]0000#_Py_PACK_VERSION(3, 14)#g" $HEADERS
sed -i -e "s#0x030[fF]0000#_Py_PACK_VERSION(3, 15)#g" $HEADERS
sed -i -e "s#0x030a00A7#_Py_PACK_VERSION(3, 10)#g" Include/refcount.h
ef5ef68 to
97324a0
Compare
|
@serhiy-storchaka, @ZeroIntensity: Would you mind reviewing the updated PR? I reverted changes on versions 3.0 to 3.9.
Ok. I regenerated the PR to only replace versions 3.10 and newer. The PR is now way smaller. Note: I used |
Revert also pyabi.h changes.
ZeroIntensity
left a comment
There was a problem hiding this comment.
I think pre-3.10 stuff would be fine to do as well, but I'm happy with this too.
|
Sanitizers / TSan (free-threading): test_capi fails. It should be fixed by #162154. |
The TSan PR has been merged. I updated this PR branch to retrieve the fix. |
|
🤖 New build scheduled with the buildbot fleet by @vstinner for commit e1d5655 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F161622%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
|
I merged the main branch into my branch to solve a merge conflict. I also modifed pyabi.h to use _Py_PACK_VERSION(). I don't recall why I didn't do this change previously. I scheduled buildbot jobs to make sure that test_cext pass on buildbots. Some test_cext tests defines Py_TARGET_ABI3T: so I would like to make sure that everything is fine. |
|
The test suite completed successfully on most buildbots: Linux, Windows, macOS, FreeBSD. Some buildbots failed, for unrelated reasons. A buildbot exception occurred, logs are empty.
Known failure: |
|
Merged. Thanks for the review @ZeroIntensity. I restricted the scope of this change to leave versions checks on Python version 3.2 to 3.9 unchanged. Only checks on Python version 3.10 to 3.16 are updated to use _Py_PACK_VERSION().
I can backport the change to 3.15, but I'm not sure about doing it. For now, I prefer to not backport, and see how it goes in main. I can backport it later if it becomes too annoying to backport C API changes. The change can be generated using shell commands giving the PR description. |
Move _Py_PACK_VERSION() from pymacro.h to patchlevel.h.
PR generated with these shell commands on Linux: