Registry Mirror
Skip to content

Support PyLong_AsNativeBytes()? #107

Closed as not planned
Closed as not planned

Description

@skirpichev

I would guess it wasn't supported, well, for obvious reasons (complexity).

But if it's going to be used in PyLong_Export() - maybe we should revisit it?

Activity

  1. vstinner commented on Sep 18, 2024

    @vstinner
    Member

    The implementation is about 186 lines. IMO it's too big and too complex for pythoncapi-compat sadly :-( The https://github.com/vstinner/deadparrot would be a better place to backport such feature.

  2. skirpichev commented on Sep 18, 2024

    @skirpichev
    MemberAuthor

    Then maybe using PyLong_AsLongAndOverflow() is better for PyLong_Export. I did pr to switch: vstinner/cpython#6. This clear practical need for backport.

  3. vstinner commented on Sep 18, 2024

    @vstinner
    Member

    You shouldn't worry about pythoncapi-compat: there is a great freedom on how we can do things in pythoncapi-compat. It shouldn't impact PEP 757 design.

  4. skirpichev commented on Sep 18, 2024

    @skirpichev
    MemberAuthor

    Sure, we could use PyLong_AsLongAndOverflow() just for backports. But it looks faster than current solution, at least for my benchmarks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions