Skip to content

Consider adding public PyLong_GetSign() function #116560

Closed
@skirpichev

Description

@skirpichev

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#L56

PyLong_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

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions