Description
- Version: 5.31.1
- Python: 3.8
- OS: linux
- pip freeze output omitted since not a package specific issue
What was wrong?
Note: Not exactly an issue but something I had to circumvent myself when using the library and thinking it may be helpful if web3.py
handled it instead directly.
I was trying to use functions requiring __hash__
on event logs and the code failed saying lists are not hashable here. This happens if the event logs contain list
objects nested inside them (which some smart contracts seem to return), as lists by default are mutable and thus not hashable in Python.
How can it be fixed?
Would it make sense to (possibly recursively) cast any present lists to tuples inside the hash function to avoid crashes? Would some detection mechanism inside these pseudo-immutable classes be helpful to make sure they are indeed hashable (e.g., raising an error if a list is added)?
Any thoughts?