diff options
author | Donald Stufft <donald@stufft.io> | 2014-12-15 07:41:02 -0500 |
---|---|---|
committer | Donald Stufft <donald@stufft.io> | 2014-12-15 07:41:02 -0500 |
commit | c0d31b5915055be20b8593170cddb85770b9ccc9 (patch) | |
tree | 069faa665b59f1fc56ce91c435665fd981f6d88a /pkg_resources.py | |
parent | 4caa4af6ae275db9a499c27b66cc636cb9c596a1 (diff) | |
download | external_python_setuptools-c0d31b5915055be20b8593170cddb85770b9ccc9.tar.gz external_python_setuptools-c0d31b5915055be20b8593170cddb85770b9ccc9.tar.bz2 external_python_setuptools-c0d31b5915055be20b8593170cddb85770b9ccc9.zip |
Define a __hash__ on the packaging.version.Version subclasses
In Python 3.x a subclass will not inherent the __hash__ method from
the parent classes if the subclass defines a __eq__ method. This
means that without defining our own __hash__ the SetuptoolsVersion
classes are unhashable.
Diffstat (limited to 'pkg_resources.py')
-rw-r--r-- | pkg_resources.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg_resources.py b/pkg_resources.py index 5df5a3e6..4c7924b7 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -82,6 +82,9 @@ packaging = setuptools._vendor.packaging class _SetuptoolsVersionMixin(object): + def __hash__(self): + return super(_SetuptoolsVersionMixin, self).__hash__() + def __lt__(self, other): if isinstance(other, tuple): return tuple(self) < other |