Skip to content

Hashing enums #105

Answered by wjakob
mnijhuis-tos asked this question in Q&A
Dec 2, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hi @mnijhuis-tos -- that's a good catch. Could you create a PR that implements the hashing function in the libnanobind component? (specifically, that would be in the file src/nb_enum.cpp). Instead of using .def("__hash__", ...) would do this at a lower level by providing the Py_tp_hash type slot in this file. Hopefully it's clear enough if you look at the other code there.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mnijhuis-tos
Comment options

Answer selected by mnijhuis-tos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants