Skip to content

Deprecate Py_HASH_EXTERNAL as it cannot be used for --with-hash-algorithm #141226

@picnixz

Description

@picnixz

Bug report

Bug description:

In PEP-456, we introduced the notion of interchangeable hash functions for strings, bytes and memoryviews. Historically, Python used FNV as its hash algorithm, switched to SipHash2-4 in 3.4 before making SipHash1-3 the default in 3.11. It is however possible for embedders to implement their own hashing algorithms but this requires Python to be configured with --with-hash-algorithm=external and linking Python with the appropriate additional library.

Unfortunately, it's not possible to choose external and the only workaround would be to pass -DPy_HASH_ALGORITHM 0 but this is neither documented nor tested (it may not even work if the macro is still defined afterwards).

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

Labels

buildThe build process and cross-buildinterpreter-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