Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r96360:fa16b2515a57
Date: 2019-03-27 12:36 +0100
http://bitbucket.org/pypy/pypy/changeset/fa16b2515a57/

Log:    Be more informative, just because we can

diff --git a/pypy/module/array/interp_array.py 
b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -721,7 +721,8 @@
             except OperationError as e:
                 if not e.match(space, space.w_ValueError):
                     raise
-                r = '<character out of range>'
+                w_exc_value = e.get_w_value(space)
+                r = "<%s>" % (space.str_w(w_exc_value),)
             else:
                 r = space.text_w(space.repr(w_unicode))
             s = "array('%s', %s)" % (self.typecode, r)
diff --git a/pypy/module/array/test/test_array.py 
b/pypy/module/array/test/test_array.py
--- a/pypy/module/array/test/test_array.py
+++ b/pypy/module/array/test/test_array.py
@@ -853,7 +853,8 @@
         b.byteswap()
         assert a != b
         assert str(a) == "array('u', %r)" % (input_unicode,)
-        assert str(b) == "array('u', <character out of range>)"
+        assert str(b) == ("array('u', <character U+1000000 is not in"
+                          " range [U+0000; U+10ffff]>)")
         assert a.tounicode() == input_unicode
         raises(ValueError, b.tounicode)   # doesn't work
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to