]> granicus.if.org Git - python/commitdiff
Merged revisions 79780 via svnmerge from
authorPhilip Jenvey <pjenvey@underboss.org>
Wed, 9 Jun 2010 17:56:11 +0000 (17:56 +0000)
committerPhilip Jenvey <pjenvey@underboss.org>
Wed, 9 Jun 2010 17:56:11 +0000 (17:56 +0000)
svn+ssh://pythondev@svn.python.org/python/branches/py3k

................
  r79780 | philip.jenvey | 2010-04-04 20:05:24 -0700 (Sun, 04 Apr 2010) | 9 lines

  Merged revisions 79779 via svnmerge from
  svn+ssh://pythondev@svn.python.org/python/trunk

  ........
    r79779 | philip.jenvey | 2010-04-04 19:51:51 -0700 (Sun, 04 Apr 2010) | 2 lines

    fix escape_encode to return the correct consumed size
  ........
................

Lib/test/test_codecs.py
Misc/NEWS
Modules/_codecsmodule.c

index 5d6b5453f550418956388ef1420084077ec0b2c8..5db5dcb98165bc8370672982362973cb4a382242 100644 (file)
@@ -915,6 +915,8 @@ class UnicodeInternalTest(unittest.TestCase):
         self.assertEquals(encoder("a")[1], 1)
         self.assertEquals(encoder("\xe9\u0142")[1], 2)
 
+        self.assertEquals(codecs.escape_encode(br'\x00')[1], 4)
+
 # From http://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html
 nameprep_tests = [
     # 3.1 Map to nothing.
index 5fe35fc466748c848bda3b06a8b57727c8654d0d..9638ebd4885c930594e10ac4253bb6c82f8b6c36 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -57,6 +57,8 @@ C-API
 Library
 -------
 
+- Fix codecs.escape_encode to return the correct consumed size.
+
 - Issue #8897: Fix sunau module, use bytes to write the header. Patch written
   by Thomas Jollans.
 
index a23b073d18bed68bd6504500d919a360b04fe3d5..aac44703adfa1cbafc25385a46bf5c9d083e5d01 100644 (file)
@@ -217,7 +217,7 @@ escape_encode(PyObject *self,
         }
     }
 
-    return codec_tuple(v, PyBytes_Size(v));
+    return codec_tuple(v, size);
 }
 
 /* --- Decoder ------------------------------------------------------------ */