Bug 780329 - Part 4: Define CompilerWarning.__cmp__; r=jhammel DONTBUILD (NPOTB)
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user