Closed vstinner closed 5 months ago
Now, how can we take a decision to move on?
My first choice is to keep the existing private API and close this issue. My second choice is to rename the existing API to remove the leading underscore without semantic changes (i.e., API A).
Multiple APIs were discussed in the same issue and it's uneasy for me to follow which API is being referred to, so I created a new issue to add a new Py_hash_t Py_HashDouble(double, PyObject *obj)
function: https://github.com/capi-workgroup/decisions/issues/10
Similarly to this, it would be nice to expose a public Py_hash_t Py_HashBytes(const void*, Py_ssize_t)
function. This is required to make buffer-like objects hashable in a way that's consistent with Python's bytes and memoryview objects.
Similarly to this, it would be nice to expose a public Py_hash_t Py_HashBytes(const void*, Py_ssize_t) function.
I suggest to open a new issue for this.
Apparently, the C API Working Group failed to take a decision on this API.
On January 31st, @gvanrossum wrote on the companion issue #10:
I'm taking an executive decision and closing this issue for lack of progress.
So I also close this issue. numpy will have to continue using the private _Py_HashDouble()
function for now.
PR: https://github.com/python/cpython/pull/112449
API:
int Py_HashDouble(double value, Py_hash_t *result)
*result
to the hash value and return 1 on success.*result
to 0 and return 0 if the hash value cannot be calculated. For example, if value is not-a-number (NaN).NULL
Stable ABI: compatible
Not added to the limited C API yet
UPDATE: I updated the API documation to address @zooba's suggestion (make the API more generic, be less specific about NaN case).
Voters:
Since I proposed this API and I'm part of the C API Working Group, I will not vote on this decision.