Author: Alex Gaynor <alex.gay...@gmail.com>
Branch: stdlib-2.7.8
Changeset: r73112:3f0c24c4ae4a
Date: 2014-08-28 09:58 -0700
http://bitbucket.org/pypy/pypy/changeset/3f0c24c4ae4a/

Log:    Fixed translation and a bug with replace error handler

diff --git a/rpython/rlib/runicode.py b/rpython/rlib/runicode.py
--- a/rpython/rlib/runicode.py
+++ b/rpython/rlib/runicode.py
@@ -800,6 +800,7 @@
     result = UnicodeBuilder(size)
     pos = 0
     shiftOutStartPos = 0
+    startinpos = 0
     while pos < size:
         ch = s[pos]
         oc = ord(ch)
@@ -874,7 +875,7 @@
                     result.append(unichr(ord(ch)))
 
         elif ch == '+':
-            startingpos = pos
+            startinpos = pos
             pos += 1 # consume '+'
             if pos < size and s[pos] == '-': # '+-' encodes '+'
                 pos += 1
@@ -889,7 +890,7 @@
             result.append(unichr(oc))
             pos += 1
         else:
-            startingpos = pos
+            startinpos = pos
             pos += 1
             msg = "unexpected special character"
             res, pos = errorhandler(errors, 'utf7', msg, s, pos-1, pos)
@@ -905,8 +906,9 @@
             msg = "unterminated shift sequence"
             res, pos = errorhandler(errors, 'utf7', msg, s, shiftOutStartPos, 
pos)
             result.append(res)
+            final_length = result.getlength()
     elif inShift:
-        pos = startingpos
+        pos = startinpos
         final_length = shiftOutStartPos # back off output
 
     assert final_length >= 0
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to