Author: Philip Jenvey <[email protected]>
Branch: py3k
Changeset: r60072:ad0e6caa6591
Date: 2013-01-14 16:22 -0800
http://bitbucket.org/pypy/pypy/changeset/ad0e6caa6591/

Log:    stricter boolean check, fixes test_builtin's obscure
        test_baddecorator

diff --git a/pypy/objspace/std/listobject.py b/pypy/objspace/std/listobject.py
--- a/pypy/objspace/std/listobject.py
+++ b/pypy/objspace/std/listobject.py
@@ -1539,7 +1539,7 @@
 def list_sort__List_ANY_ANY(space, w_list, w_keyfunc, w_reverse):
 
     has_key = not space.is_w(w_keyfunc, space.w_None)
-    has_reverse = space.is_true(w_reverse)
+    has_reverse = bool(space.int_w(w_reverse))
 
     # create and setup a TimSort instance
     if 0:
diff --git a/pypy/objspace/std/test/test_listobject.py 
b/pypy/objspace/std/test/test_listobject.py
--- a/pypy/objspace/std/test/test_listobject.py
+++ b/pypy/objspace/std/test/test_listobject.py
@@ -588,6 +588,7 @@
         l = [1]
         l.sort(reverse = True)
         assert l == [1]
+        raises(TypeError, sorted, [], None, lambda x, y: 0)
 
     def test_sort_cmp_key_reverse(self):
         def lower(x): return x.lower()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to