[pypy-commit] pypy py3k: bytes/str stuff in codec errorhandler

amauryfa noreply at buildbot.pypy.org
Thu Oct 13 23:13:02 CEST 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r48038:7735d20e8f56
Date: 2011-10-13 23:12 +0200
http://bitbucket.org/pypy/pypy/changeset/7735d20e8f56/

Log:	bytes/str stuff in codec errorhandler

diff --git a/pypy/module/_codecs/interp_codecs.py b/pypy/module/_codecs/interp_codecs.py
--- a/pypy/module/_codecs/interp_codecs.py
+++ b/pypy/module/_codecs/interp_codecs.py
@@ -21,12 +21,14 @@
             w_errorhandler = lookup_error(space, errors)
             if decode:
                 w_cls = space.w_UnicodeDecodeError
+                w_input = space.wrapbytes(input)
             else:
                 w_cls = space.w_UnicodeEncodeError
+                w_input = space.wrap(input)
             w_exc =  space.call_function(
                 w_cls,
                 space.wrap(encoding),
-                space.wrap(input),
+                w_input,
                 space.wrap(startpos),
                 space.wrap(endpos),
                 space.wrap(reason))
@@ -59,7 +61,7 @@
             else:
                 from pypy.objspace.std.unicodetype import encode_object
                 w_str = encode_object(space, w_replace, encoding, None)
-                replace = space.str_w(w_str)
+                replace = space.bytes_w(w_str)
                 return replace, newpos
         return unicode_call_errorhandler
 


More information about the pypy-commit mailing list