Bug 780329 - Part 4: Define CompilerWarning.__cmp__; r=jhammel DONTBUILD (NPOTB)

This commit is contained in:
Gregory Szorc
2012-09-21 12:05:37 -07:00
parent adffaf2bf3
commit eec3df1c56

View File

@@ -71,6 +71,18 @@ class CompilerWarning(dict):
"""Define so this can exist inside a set, etc."""
return hash(tuple(sorted(self.items())))
def __cmp__(self, other):
if not isinstance(other, CompilerWarning):
return -1
for key in ('filename', 'line', 'column'):
x = cmp(self[key], other[key])
if x != 0:
return x
return 0
class WarningsDatabase(object):
"""Holds a collection of warnings.