[pypy-commit] pypy default: still use cmp builtin on py2, only apply manual case for py3

bdkearns noreply at buildbot.pypy.org
Fri Mar 14 20:37:53 CET 2014


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r69963:ddbc70485efb
Date: 2014-03-14 15:36 -0400
http://bitbucket.org/pypy/pypy/changeset/ddbc70485efb/

Log:	still use cmp builtin on py2, only apply manual case for py3

diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -38,6 +38,7 @@
 
 if sys.version_info[0] >= 3:
     StandardError = Exception
+    cmp = lambda x, y: (x > y) - (x < y)
     long = int
     xrange = range
     basestring = unicode = str
@@ -778,7 +779,7 @@
                 try:
                     ret = callback(text1, text2)
                     assert isinstance(ret, (int, long))
-                    return (ret > 0) - (ret < 0)
+                    return cmp(ret, 0)
                 except Exception:
                     return 0
 


More information about the pypy-commit mailing list