[pypy-commit] pypy py3k: make sure to call __str__ when formatting subclasses of str. This fixes test_format_unicode_subclass
antocuni
noreply at buildbot.pypy.org
Thu Mar 15 18:39:17 CET 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r53682:16e67dc2726d
Date: 2012-03-15 16:31 +0100
http://bitbucket.org/pypy/pypy/changeset/16e67dc2726d/
Log: make sure to call __str__ when formatting subclasses of str. This
fixes test_format_unicode_subclass
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
@@ -553,7 +553,7 @@
def format_string(self, w_string):
space = self.space
- if not space.isinstance_w(w_string, space.w_unicode):
+ if not space.is_w(space.type(w_string), space.w_unicode):
w_string = space.str(w_string)
string = space.unicode_w(w_string)
if self._parse_spec("s", "<"):
More information about the pypy-commit
mailing list