mirror of https://github.com/python/cpython
backport change from trunk
This commit is contained in:
parent
d0c92a4db0
commit
4b32dd77d4
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue