[pypy-svn] r76105 - pypy/branch/fast-forward/pypy/objspace/std

benjamin at codespeak.net benjamin at codespeak.net
Sun Jul 11 06:16:30 CEST 2010


Author: benjamin
Date: Sun Jul 11 06:16:28 2010
New Revision: 76105

Modified:
   pypy/branch/fast-forward/pypy/objspace/std/newformat.py
Log:
tiptoe around unicode annotation

Modified: pypy/branch/fast-forward/pypy/objspace/std/newformat.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/newformat.py	(original)
+++ pypy/branch/fast-forward/pypy/objspace/std/newformat.py	Sun Jul 11 06:16:28 2010
@@ -401,8 +401,15 @@
             return rstring.StringBuilder()
 
     def _unknown_presentation(self, tp):
-        msg = "unknown presentation for %s: '%s'" % (tp, self._type)
-        raise OperationError(self.space.w_ValueError, self.space.wrap(msg))
+        msg = "unknown presentation for %s: '%s'"
+        if self.is_unicode:
+            the_msg = unicode(msg)
+            the_tp = tp.decode("ascii")
+        else:
+            the_msg = msg
+            the_tp = tp
+        w_msg = self.space.wrap(the_msg  % (the_tp, self._type))
+        raise OperationError(self.space.w_ValueError, w_msg)
 
     def format_string(self, string):
         space = self.space



More information about the Pypy-commit mailing list