Bug 1547730 - Define __hash__ for SandboxDependsFunction and CombinedDependsFunction so we can reference it as a dictionary key in py3 r=glandium
authorJustin Wood <Callek@gmail.com>
Tue, 28 May 2019 14:28:30 +0000
changeset 475908 bd44eb6beabbe041fb851d632e84780b5a7be24d
parent 475907 577509d87235ee88b5fae2ad732b0b892c7e37c3
child 475909 d89d2754488ec74c628efa4da471f8497405ce01
push id86529
push userjwood@mozilla.com
push dateTue, 28 May 2019 14:47:17 +0000
treeherderautoland@dbadda4e3c1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1547730
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1547730 - Define __hash__ for SandboxDependsFunction and CombinedDependsFunction so we can reference it as a dictionary key in py3 r=glandium Differential Revision: https://phabricator.services.mozilla.com/D28111
python/mozbuild/mozbuild/configure/__init__.py
--- a/python/mozbuild/mozbuild/configure/__init__.py
+++ b/python/mozbuild/mozbuild/configure/__init__.py
@@ -73,16 +73,19 @@ class SandboxDependsFunction(object):
         return self._and(other).sandboxed
 
     def __cmp__(self, other):
         raise ConfigureError('Cannot compare @depends functions.')
 
     def __eq__(self, other):
         raise ConfigureError('Cannot compare @depends functions.')
 
+    def __hash__(self):
+        return object.__hash__(self)
+
     def __ne__(self, other):
         raise ConfigureError('Cannot compare @depends functions.')
 
     def __lt__(self, other):
         raise ConfigureError('Cannot compare @depends functions.')
 
     def __le__(self, other):
         raise ConfigureError('Cannot compare @depends functions.')
@@ -227,16 +230,19 @@ class CombinedDependsFunction(DependsFun
                          for d in self.dependencies)
         return self._func(resolved_args)
 
     def __eq__(self, other):
         return (isinstance(other, self.__class__) and
                 self._func is other._func and
                 set(self.dependencies) == set(other.dependencies))
 
+    def __hash__(self):
+        return object.__hash__(self)
+
     def __ne__(self, other):
         return not self == other
 
 
 class SandboxedGlobal(dict):
     '''Identifiable dict type for use as function global'''