[pypy-commit] pypy stdlib-2.7.4: fix sqlite3 CheckCollationReturnsLargeInteger

bdkearns noreply at buildbot.pypy.org
Wed Apr 10 06:33:29 CEST 2013


Author: Brian Kearns <bdkearns at gmail.com>
Branch: stdlib-2.7.4
Changeset: r63189:87013e33e1f1
Date: 2013-04-09 23:24 -0400
http://bitbucket.org/pypy/pypy/changeset/87013e33e1f1/

Log:	fix sqlite3 CheckCollationReturnsLargeInteger

diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -757,8 +757,12 @@
             def collation_callback(context, len1, str1, len2, str2):
                 text1 = _ffi.buffer(str1, len1)[:]
                 text2 = _ffi.buffer(str2, len2)[:]
-
-                return callback(text1, text2)
+                try:
+                    ret = callback(text1, text2)
+                    assert isinstance(ret, (int, long))
+                    return cmp(ret, 0)
+                except Exception:
+                    return 0
 
             self.__collations[name] = collation_callback
 


More information about the pypy-commit mailing list