mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
gh-106320: Remove private _PyLong_Sign() (#108743)
Move the private _PyLong_Sign() and _PyLong_NumBits() functions to the internal C API (pycore_long.h). Modules/_testcapi/long.c now uses the internal C API.
This commit is contained in:
parent
c1e2f3b2f7
commit
3edcf743e8
4 changed files with 23 additions and 15 deletions
|
@ -58,6 +58,23 @@ PyAPI_FUNC(PyLongObject*) _PyLong_FromDigits(
|
|||
Py_ssize_t digit_count,
|
||||
digit *digits);
|
||||
|
||||
// _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0.
|
||||
// v must not be NULL, and must be a normalized long.
|
||||
// There are no error cases.
|
||||
//
|
||||
// Export for '_pickle' shared extension.
|
||||
PyAPI_FUNC(int) _PyLong_Sign(PyObject *v);
|
||||
|
||||
// _PyLong_NumBits. Return the number of bits needed to represent the
|
||||
// absolute value of a long. For example, this returns 1 for 1 and -1, 2
|
||||
// for 2 and -2, and 2 for 3 and -3. It returns 0 for 0.
|
||||
// v must not be NULL, and must be a normalized long.
|
||||
// (size_t)-1 is returned and OverflowError set if the true result doesn't
|
||||
// fit in a size_t.
|
||||
//
|
||||
// Export for 'math' shared extension.
|
||||
PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v);
|
||||
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue