mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-128863: Deprecate _PyLong_Sign() function (#129176)
Replace _PyLong_Sign() with PyLong_GetSign().
This commit is contained in:
parent
0093a31273
commit
1d485db953
9 changed files with 29 additions and 15 deletions
|
@ -25,7 +25,6 @@
|
|||
#include "pycore_hashtable.h" // _Py_hashtable_new()
|
||||
#include "pycore_initconfig.h" // _Py_GetConfigsAsDict()
|
||||
#include "pycore_instruction_sequence.h" // _PyInstructionSequence_New()
|
||||
#include "pycore_long.h" // _PyLong_Sign()
|
||||
#include "pycore_object.h" // _PyObject_IsFreed()
|
||||
#include "pycore_optimizer.h" // JitOptSymbol, etc.
|
||||
#include "pycore_pathconfig.h" // _PyPathConfig_ClearGlobal()
|
||||
|
@ -1798,14 +1797,14 @@ _testinternalcapi_test_long_numbits_impl(PyObject *module)
|
|||
|
||||
for (i = 0; i < Py_ARRAY_LENGTH(testcases); ++i) {
|
||||
uint64_t nbits;
|
||||
int sign;
|
||||
int sign = -7;
|
||||
PyObject *plong;
|
||||
|
||||
plong = PyLong_FromLong(testcases[i].input);
|
||||
if (plong == NULL)
|
||||
return NULL;
|
||||
nbits = _PyLong_NumBits(plong);
|
||||
sign = _PyLong_Sign(plong);
|
||||
(void)PyLong_GetSign(plong, &sign);
|
||||
|
||||
Py_DECREF(plong);
|
||||
if (nbits != testcases[i].nbits)
|
||||
|
@ -1813,7 +1812,7 @@ _testinternalcapi_test_long_numbits_impl(PyObject *module)
|
|||
"wrong result for _PyLong_NumBits");
|
||||
if (sign != testcases[i].sign)
|
||||
return raiseTestError("test_long_numbits",
|
||||
"wrong result for _PyLong_Sign");
|
||||
"wrong result for PyLong_GetSign()");
|
||||
}
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue