[pypy-commit] pypy py3k: the exception message is an unicode now

antocuni noreply at buildbot.pypy.org
Thu Aug 2 19:10:45 CEST 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r56541:03dd574124f0
Date: 2012-08-02 18:51 +0200
http://bitbucket.org/pypy/pypy/changeset/03dd574124f0/

Log:	the exception message is an unicode now

diff --git a/pypy/interpreter/argument.py b/pypy/interpreter/argument.py
--- a/pypy/interpreter/argument.py
+++ b/pypy/interpreter/argument.py
@@ -771,13 +771,9 @@
                             # note: negative-based indexing from the end
                             w_name = keyword_names_w[i - len(keywords)]
                         except IndexError:
-                            name = '?'
+                            name = u'?'
                         else:
-                            w_enc = space.wrap(space.sys.defaultencoding)
-                            w_err = space.wrap("replace")
-                            w_name = space.call_method(w_name, "encode", w_enc,
-                                                       w_err)
-                            name = space.str_w(w_name)
+                            name = space.unicode_w(w_name)
                     break
         self.kwd_name = name
 
diff --git a/pypy/interpreter/test/test_argument.py b/pypy/interpreter/test/test_argument.py
--- a/pypy/interpreter/test/test_argument.py
+++ b/pypy/interpreter/test/test_argument.py
@@ -617,7 +617,7 @@
                                 [True, False, True, True],
                                 [unichr(0x1234), u'b', u'c'])
         s = err.getmsg()
-        assert s == "got an unexpected keyword argument '\xe1\x88\xb4'"
+        assert s == "got an unexpected keyword argument '%s'" % unichr(0x1234)
 
     def test_multiple_values(self):
         err = ArgErrMultipleValues('bla')


More information about the pypy-commit mailing list