Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensured that dtype subclasses are hashable
Python data model requires a class to implement both `__eq__` *and* `__hash__` to be considered hashable. If a class only implements `__eq__`, it gets an auto-generated `__hash__ = None`, which makes it non-hashable. So, as things stand, `tl.pointer_type` and `tl.block_type` instances fail to hash. The fix is to define __hash__ explicitly in the class body, as suggested in [*]: > If a class that overrides __eq__() needs to retain the implementation of > __hash__() from a parent class, the interpreter must be told this explicitly > by setting __hash__ = <ParentClass>.__hash__. [*]: https://docs.python.org/3/reference/datamodel.html#object.__hash__
- Loading branch information