[pypy-commit] pypy default: use int formatter for bool, cause it already calls str if spec is empty
kostialopuhin
noreply at buildbot.pypy.org
Wed Jun 20 23:55:53 CEST 2012
Author: Konstantin Lopuhin <kostia.lopuhin at gmail.com>
Branch:
Changeset: r55741:3026da361750
Date: 2012-06-21 01:27 +0400
http://bitbucket.org/pypy/pypy/changeset/3026da361750/
Log: use int formatter for bool, cause it already calls str if spec is
empty
diff --git a/pypy/objspace/std/boolobject.py b/pypy/objspace/std/boolobject.py
--- a/pypy/objspace/std/boolobject.py
+++ b/pypy/objspace/std/boolobject.py
@@ -71,6 +71,7 @@
def format__Bool_ANY(space, w_bool, w_format_spec):
return newformat.run_formatter(
- space, w_format_spec, "format_bool", w_bool)
+ space, w_format_spec, "format_int_or_long", w_bool,
+ newformat.INT_KIND)
register_all(vars())
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
@@ -877,12 +877,6 @@
buf[i] = "-"
assert i >= 0
return self.empty.join(buf[i:])
-
- def format_bool(self, w_bool):
- 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
More information about the pypy-commit
mailing list