backport change from trunk

This commit is contained in:
Benjamin Peterson 2009-12-16 04:27:27 +00:00
parent d0c92a4db0
commit 4b32dd77d4
1 changed files with 2 additions and 0 deletions

View File

@ -1776,6 +1776,8 @@ order (MRO) for bases """
# Safety test for __cmp__ # Safety test for __cmp__
def unsafecmp(a, b): def unsafecmp(a, b):
if not hasattr(a.__class__, "__cmp__"):
return
try: try:
a.__class__.__cmp__(a, b) a.__class__.__cmp__(a, b)
except TypeError: except TypeError: