Skip to content

Conversation

@virtuald
Copy link
Member

@virtuald virtuald merged commit 649a039 into main Dec 19, 2022
@virtuald virtuald deleted the select-command branch December 19, 2022 05:19
SelectCommandKey &operator=(const py::handle src) {
py::gil_scoped_acquire gil;
m_v = py::reinterpret_borrow<py::object>(src);
m_hash = m_v.attr("__hash__")().cast<std::size_t>();
Copy link
Member

Choose a reason for hiding this comment

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

isn't this technically incorrect if a __hash__ attribute is set on an object? hash() would still call the real __hash__ method, but accessing the attribute would not

I believe pybind11 has a helper for this: https://pybind11.readthedocs.io/en/stable/reference.html#_CPPv44hash6handle

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.

SelectCommand not implemented

3 participants