]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backported from the trunk, on Raymond's request:
authorThomas Heller <theller@ctypes.org>
Thu, 4 Dec 2003 21:07:57 +0000 (21:07 +0000)
committerThomas Heller <theller@ctypes.org>
Thu, 4 Dec 2003 21:07:57 +0000 (21:07 +0000)
SF bug #849662.  Dramatically, improve comparison speed for "if shl == None".

Lib/UserDict.py

index 6b5c9dade6ac694431b34821a23083e10ecac2e6..35f86fc4dc1076ad0eeeb862e44d290552657297 100644 (file)
@@ -155,6 +155,8 @@ class DictMixin:
     def __repr__(self):
         return repr(dict(self.iteritems()))
     def __cmp__(self, other):
+        if other is None:
+            return 1
         if isinstance(other, DictMixin):
             other = dict(other.iteritems())
         return cmp(dict(self.iteritems()), other)