Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

class apitools.base.protorpclite.messages.Message is unhashable in Python 3 #261

Open
ttanay opened this issue Mar 3, 2019 · 0 comments

Comments

@ttanay
Copy link

ttanay commented Mar 3, 2019

The class apitools.base.protorpclite.messages.Message is an unhashable type in Python 3 and as a result, raises a TypeError when used as a key in a dict.

The reason for this is that in Python 3.x "a class that overrides __eq__() and does not define __hash__() will have its __hash__() implicitly set to None" (https://docs.python.org/3.6/reference/datamodel.html#object.__hash__). This makes it unhashable.

In Python 2, since __eq__() was defined, it simply inherited the __hash__() from object. In Python 3 it doesn't.

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

No branches or pull requests

1 participant