[llvm-commits] [zorg] r147538 - /zorg/trunk/lnt/lnt/server/db/testsuitedb.py

Daniel Dunbar daniel at zuster.org
Wed Jan 4 10:33:53 PST 2012


Author: ddunbar
Date: Wed Jan  4 12:33:53 2012
New Revision: 147538

URL: http://llvm.org/viewvc/llvm-project?rev=147538&view=rev
Log:
[lnt/v0.4] lnt.server.db.testsuitedb: Prevent a crash in cases where SA wants to
compare model instances to some sentinel objects (which is poor form, but
whatever).

Modified:
    zorg/trunk/lnt/lnt/server/db/testsuitedb.py

Modified: zorg/trunk/lnt/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/db/testsuitedb.py?rev=147538&r1=147537&r2=147538&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/testsuitedb.py (original)
+++ zorg/trunk/lnt/lnt/server/db/testsuitedb.py Wed Jan  4 12:33:53 2012
@@ -144,6 +144,12 @@
                     db_key_name, self.__class__.__name__, self.ordinal, fields)
 
             def __cmp__(self, b):
+                # SA occassionally uses comparison to check model instances
+                # verse some sentinels, so we ensure we support comparison
+                # against non-instances.
+                if self.__class__ is not b.__class__:
+                    return -1
+
                 return cmp(tuple(self.get_field(item)
                                  for item in self.fields),
                            tuple(b.get_field(item)





More information about the llvm-commits mailing list