Commits

Philip Jenvey  committed ad0e6ca

stricter boolean check, fixes test_builtin's obscure test_baddecorator

  • Participants
  • Parent commits 92dd4a5
  • Branches py3k

Comments (0)

Files changed (2)

File pypy/objspace/std/listobject.py

 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:

File pypy/objspace/std/test/test_listobject.py

         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()