summaryrefslogtreecommitdiffstats
path: root/Lib/UserDict.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2003-12-04 20:04:09 (GMT)
committerRaymond Hettinger <python@rcn.com>2003-12-04 20:04:09 (GMT)
commitf477c884509ad5e6a4d2ef583dae9eb1cd6d125d (patch)
tree5389ed6d182f236d9304ec5e3075da974e946e40 /Lib/UserDict.py
parentedfb30258ea262cb67c1e48e4b122bf7e1b8b674 (diff)
downloadcpython-f477c884509ad5e6a4d2ef583dae9eb1cd6d125d.zip
cpython-f477c884509ad5e6a4d2ef583dae9eb1cd6d125d.tar.gz
cpython-f477c884509ad5e6a4d2ef583dae9eb1cd6d125d.tar.bz2
SF bug #849662. Dramatically, improve comparison speed for "if shl == None".
Diffstat (limited to 'Lib/UserDict.py')
-rw-r--r--Lib/UserDict.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/UserDict.py b/Lib/UserDict.py
index 6b5c9da..35f86fc 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)