gh-116560: Add PyLong_GetSign() public function (#116561)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Sergey B Kirpichev 2024-06-03 15:06:31 +03:00 committed by GitHub
parent 367adc91fb
commit 61d3ab32da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 66 additions and 3 deletions

View file

@ -494,6 +494,19 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
.. versionadded:: 3.13
.. c:function:: int PyLong_GetSign(PyObject *obj, int *sign)
Get the sign of the integer object *obj*.
On success, set *\*sign* to the integer sign (0, -1 or +1 for zero, negative or
positive integer, respectively) and return 0.
On failure, return -1 with an exception set. This function always succeeds
if *obj* is a :c:type:`PyLongObject` or its subtype.
.. versionadded:: 3.14
.. c:function:: int PyUnstable_Long_IsCompact(const PyLongObject* op)
Return 1 if *op* is compact, 0 otherwise.