Skip to content

add Py_HashBuffer to pyo3-ffi #5086

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

Merged
merged 5 commits into from
Apr 28, 2025
Merged

Conversation

bschoenmaeckers
Copy link
Member

It is maybe too early to add support for python 3.14 function, but this paves the way to remove the private _Py_HashBytes.

ref pythoncapi-compat

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is fine, we'll be adding 3.14 support very soon 👍

@davidhewitt davidhewitt added this pull request to the merge queue Apr 23, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 23, 2025
Comment on lines 17 to 19

#[cfg(Py_3_14)]
pub fn Py_HashBuffer(ptr: *const c_void, len: Py_ssize_t) -> Py_hash_t;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this should be located in src/cpython/pyhash.rs (that file may need updating); maybe please sync this file with 3.13 locations while you're at it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, I picked the wrong pyhash file. Will do an update as well!

@bschoenmaeckers bschoenmaeckers force-pushed the hashbuffer branch 3 times, most recently from ddc93f9 to cf03378 Compare April 25, 2025 09:16
Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Py_HashPointer and PyObject_GenericHash need to be mentioned in the changelog, otherwise LGTM 👍

@bschoenmaeckers bschoenmaeckers added this pull request to the merge queue Apr 25, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 25, 2025
@bschoenmaeckers
Copy link
Member Author

I think the ci does not like adding python 3.14 functions. @davidhewitt should we wait for full 3.14 support?

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's just the PyPy failure which is a problem.

use std::os::raw::{c_char, c_int, c_void};

#[repr(C)]
#[derive(Copy, Clone)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[derive(Copy, Clone)]
#[derive(Copy, Clone)]
#[cfg(not(any(PyPy, GraalPy)))]`

... and similar for PyHash_GetFuncDef, perhaps.

Verified

This commit was signed with the committer’s verified signature.
bschoenmaeckers Bas Schoenmaeckers

Verified

This commit was signed with the committer’s verified signature.
bschoenmaeckers Bas Schoenmaeckers

Verified

This commit was signed with the committer’s verified signature.
bschoenmaeckers Bas Schoenmaeckers

Verified

This commit was signed with the committer’s verified signature.
bschoenmaeckers Bas Schoenmaeckers

Verified

This commit was signed with the committer’s verified signature.
bschoenmaeckers Bas Schoenmaeckers
@bschoenmaeckers bschoenmaeckers added this pull request to the merge queue Apr 28, 2025
@bschoenmaeckers bschoenmaeckers removed this pull request from the merge queue due to a manual request Apr 28, 2025
@bschoenmaeckers bschoenmaeckers added this pull request to the merge queue Apr 28, 2025
Merged via the queue into PyO3:main with commit 48739ac Apr 28, 2025
42 of 45 checks passed
@bschoenmaeckers bschoenmaeckers deleted the hashbuffer branch April 28, 2025 10:30
newcomertv pushed a commit to newcomertv/pyo3 that referenced this pull request Apr 28, 2025

Unverified

This user has not yet uploaded their public signing key.
* add `Py_HashBuffer` to `pyo3-ffi`

* Add `Py_HashBuffer` binding when 3.14+

* Move to `cpython/pyhash.rs`

* Update changelog

* Enable`Py_HashBuffer` compat on 3.14 abi3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants