-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider adding public PyLong_GetSign() function #116560
Comments
* rename _PyLong_Sign() to PyLong_Sign() * add argument checking, documentation and tests * keep _PyLong_Sign() as an alias to PyLong_Sign()
I think that |
I worry only on PyLongObject input (probably as most consumers of API). Why three functions better then one? (Disclaimer: API, produced by C-API WG seems too generic for me; IMHO |
Co-authored-by: Victor Stinner <[email protected]>
Implemented in commit 61d3ab3 |
Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>
@vstinner, if I correctly interpret voting, PyLong_IsPositive/Negative/Zero API got support. Lets reopen this to track implementation, as it's part of the same API? |
It is better to open a separate issue. |
Feature or enhancement
Proposal:
Currently there is no way to determine the sign of the PyLongObject value and CPython extensions use private macroses like
_PyLong_IsNegative()
: https://github.com/aleaxit/gmpy/blob/eb8dfcbd84abcfcb36b4adcb0d5c6d050731dd75/src/gmpy2_convert_gmp.c#L56PyLong_Sign()
will offer GMP-like API to do this.This was suggested before: #102471 (comment)
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: