Mercurial > cpython-lru_cache-weakref
diff Modules/_codecsmodule.c @ 62214:a2ea1a23186b 2.6
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
........
| author | Philip Jenvey <pjenvey@underboss.org> |
|---|---|
| date | Wed, 09 Jun 2010 17:55:28 +0000 |
| parents | c1145e668d72 |
| children | b36cb4602e21 |
line wrap: on
line diff
--- a/Modules/_codecsmodule.c Wed Jun 09 16:31:23 2010 +0000 +++ b/Modules/_codecsmodule.c Wed Jun 09 17:55:28 2010 +0000 @@ -179,12 +179,13 @@ 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 @@ 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
