diff options
author | Philip Jenvey <pjenvey@underboss.org> | 2010-06-09 17:55:28 (GMT) |
---|---|---|
committer | Philip Jenvey <pjenvey@underboss.org> | 2010-06-09 17:55:28 (GMT) |
commit | bc3376f66a680a0a6c003041cfca55cae05fcc61 (patch) | |
tree | 38a34d5c95c93e0450b80ad798d73e523fd2f635 /Modules | |
parent | 96ec48b4146f8cc9cd09cd99bc28bb0657a4ec47 (diff) | |
download | cpython-bc3376f66a680a0a6c003041cfca55cae05fcc61.zip cpython-bc3376f66a680a0a6c003041cfca55cae05fcc61.tar.gz cpython-bc3376f66a680a0a6c003041cfca55cae05fcc61.tar.bz2 |
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
........
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_codecsmodule.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Modules/_codecsmodule.c b/Modules/_codecsmodule.c index 5b50144..3b07b6d 100644 --- a/Modules/_codecsmodule.c +++ b/Modules/_codecsmodule.c @@ -179,12 +179,13 @@ escape_encode(PyObject *self, PyObject *str; const char *errors = NULL; char *buf; - Py_ssize_t len; + Py_ssize_t consumed, len; - if (!PyArg_ParseTuple(args, "O!|z:escape_encode", - &PyString_Type, &str, &errors)) + if (!PyArg_ParseTuple(args, "S|z:escape_encode", + &str, &errors)) return NULL; + consumed = PyString_GET_SIZE(str); str = PyString_Repr(str, 0); if (!str) return NULL; @@ -196,7 +197,7 @@ escape_encode(PyObject *self, if (_PyString_Resize(&str, len-2) < 0) return NULL; - return codec_tuple(str, PyString_Size(str)); + return codec_tuple(str, consumed); } #ifdef Py_USING_UNICODE |