Closed
Description
Bug report
There are several errors related to use of _PyLong_CompactValue()
in longobject.c
.
- The result has type
Py_ssize_t
, notintptr_t
. Although on most supported platforms it is the same. - Type cast from unsigned integer to signed integer and from signed integer to unsigned integer should be explicit.
- Downcasting should be explicit.
Some of the current code may have undefined behavior.
Linked PRs
- gh-121153: Fix some errors with use of _PyLong_CompactValue() #121154
- gh-121153: Change _PyLong_CompactValue() return type to int #121536
- [3.13] gh-121153: Fix some errors with use of _PyLong_CompactValue() (GH-121154) #121900
- [3.12] gh-121153: Fix some errors with use of _PyLong_CompactValue() … #121901