summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-06-09 07:34:05 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-06-09 07:34:05 (GMT)
commit0163d6d6ef85dd0cd0ea4ea6dce4b867e39cd6b9 (patch)
tree238ba5fe594b3f5ab5a890a75a3e0bc86e5890cb /Lib
parent7bc50714febbd1a01c5c364844df6d9bd801eb24 (diff)
downloadcpython-0163d6d6ef85dd0cd0ea4ea6dce4b867e39cd6b9.zip
cpython-0163d6d6ef85dd0cd0ea4ea6dce4b867e39cd6b9.tar.gz
cpython-0163d6d6ef85dd0cd0ea4ea6dce4b867e39cd6b9.tar.bz2
Patch #424475: Speed-up tp_compare usage, by special-casing the common
case of objects with equal types which support tp_compare. Give type objects a tp_compare function. Also add c<0 tests before a few PyErr_Occurred tests.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/UserList.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/UserList.py b/Lib/UserList.py
index ee26589..69f683e 100644
--- a/Lib/UserList.py
+++ b/Lib/UserList.py
@@ -22,7 +22,7 @@ class UserList:
if isinstance(other, UserList): return other.data
else: return other
def __cmp__(self, other):
- raise RuntimeError, "UserList.__cmp__() is obsolete"
+ return cmp(self.data, self.__cast(other))
def __contains__(self, item): return item in self.data
def __len__(self): return len(self.data)
def __getitem__(self, i): return self.data[i]