[pypy-commit] pypy py3k: fix str() on this resulting UnicodeEncodeError

pjenvey noreply at buildbot.pypy.org
Thu Dec 6 23:46:39 CET 2012


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r59350:6f4f79863643
Date: 2012-12-06 14:43 -0800
http://bitbucket.org/pypy/pypy/changeset/6f4f79863643/

Log:	fix str() on this resulting UnicodeEncodeError

diff --git a/pypy/objspace/std/strutil.py b/pypy/objspace/std/strutil.py
--- a/pypy/objspace/std/strutil.py
+++ b/pypy/objspace/std/strutil.py
@@ -213,4 +213,4 @@
     except ValueError:
         # note that we still put the original unicode string in the error
         # message, not ascii_s
-        raise ParseStringError(u"invalid literal for float(): '%s'" % s)
+        raise ParseStringError(u"invalid literal for float(): %r" % s)
diff --git a/pypy/objspace/std/test/test_floatobject.py b/pypy/objspace/std/test/test_floatobject.py
--- a/pypy/objspace/std/test/test_floatobject.py
+++ b/pypy/objspace/std/test/test_floatobject.py
@@ -433,6 +433,7 @@
 
     def test_from_string(self):
         raises(ValueError, float, "\0")
+        raises(UnicodeEncodeError, float, '\uD8F0')
 
     def test_format(self):
         f = 1.1234e200


More information about the pypy-commit mailing list