Author: Konstantin Lopuhin <[email protected]>
Branch: 
Changeset: r55738:99ddf04ded5a
Date: 2012-06-19 08:49 +0400
http://bitbucket.org/pypy/pypy/changeset/99ddf04ded5a/

Log:    #1180 - not a proper fix, but all tests pass - the fix should be
        more general

diff --git a/pypy/objspace/std/newformat.py b/pypy/objspace/std/newformat.py
--- a/pypy/objspace/std/newformat.py
+++ b/pypy/objspace/std/newformat.py
@@ -879,7 +879,11 @@
             return self.empty.join(buf[i:])
         
         def format_bool(self, w_bool):
-            return self.space.str(w_bool)
+            # FIXME - this is not a proper fix
+            if self.spec:
+                return self.format_int_or_long(w_bool, INT_KIND) 
+            else:
+                return self.space.str(w_bool)
 
         def format_int_or_long(self, w_num, kind):
             space = self.space
diff --git a/pypy/objspace/std/test/test_newformat.py 
b/pypy/objspace/std/test/test_newformat.py
--- a/pypy/objspace/std/test/test_newformat.py
+++ b/pypy/objspace/std/test/test_newformat.py
@@ -212,10 +212,11 @@
 class AppTestBoolFormat:
 
     def test_simple(self):
+        assert format(False) == "False"
+        assert format(True) == "True"
         assert "{0}".format(True) == "True"
         assert "{0}".format(False) == "False"
-        assert format(False) == "False"
-        assert format(True) == "True"
+        assert "{0} or {1}".format(True, False) == "True or False"
 
     def test_with_format(self):
         assert "{:f}".format(True) == "1.000000"
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to