Author: Philip Jenvey <[email protected]>
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
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to