Skip to content

Adding Py_HashBuffer to the Stable ABI #148233

Description

@jakirkham

Feature or enhancement

Proposal:

The function Py_HashBuffer was added in PR: #122854

This was included in Python 3.14

Would like to propose adding this to the Stable ABI

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:

This came up in discussion in the PR, but hadn't been done there as it wasn't determined previously. So would like to open this discussion

Linked PRs

Activity

  1. picnixz commented on Apr 8, 2026

    @picnixz
    Member
  2. vstinner commented on Apr 9, 2026

    @vstinner
    Member

    The function is properly documented and tested (by test_capi.test_hash). It has a well defined API. It's a good candidate for the stable ABI.

  3. vstinner commented on Apr 9, 2026

    @vstinner
    Member

    I went ahead and created github.com/capi-workgroup/decisions/issues/102 in the C API Working Group.

  4. vstinner commented on Sep 22, 2026

    @vstinner
    Member

    The C API Working Group voted in favor of adding Py_HashBuffer() to the stable ABI. I created #157966 to move Py_HashBuffer() to the limited C API.

  5. added a commit that references this issue on Sep 23, 2026
  6. vstinner commented on Sep 23, 2026

    @vstinner
    Member

    I merged my PR. Py_HashBuffer() is now available on Python 3.16 limited C API. Thanks for your suggestion @jakirkham.

    On older versions, I suppose that you should create a bytes string and call PyObject_Hash().

  7. added a commit that references this issue on Sep 23, 2026
  8. added a commit that references this issue on Sep 23, 2026
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions