diff options
-rw-r--r-- | Lib/test/test_codecs.py | 2 | ||||
-rw-r--r-- | Modules/_codecsmodule.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_codecs.py b/Lib/test/test_codecs.py index 974ebd4..d2799c3 100644 --- a/Lib/test/test_codecs.py +++ b/Lib/test/test_codecs.py @@ -905,6 +905,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. diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c index 55b593b..041e0ae 100644 --- a/Modules/_codecsmodule.c +++ b/Modules/_codecsmodule.c @@ -217,7 +217,7 @@ escape_encode(PyObject *self, } } - return codec_tuple(v, PyBytes_Size(v)); + return codec_tuple(v, size); } /* --- Decoder ------------------------------------------------------------ */ |