From: Thomas Heller Date: Thu, 4 Dec 2003 21:07:57 +0000 (+0000) Subject: Backported from the trunk, on Raymond's request: X-Git-Tag: v2.3.3c1~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aff29aeb4726ec044aad67a4075bec69af93dfdc;p=thirdparty%2FPython%2Fcpython.git Backported from the trunk, on Raymond's request: SF bug #849662. Dramatically, improve comparison speed for "if shl == None". --- diff --git a/Lib/UserDict.py b/Lib/UserDict.py index 6b5c9dade6ac..35f86fc4dc10 100644 --- a/Lib/UserDict.py +++ b/Lib/UserDict.py @@ -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)