"UnicodeInternalTest")
self.assertEquals((u"ab", 12), ignored)
+ encoder = codecs.getencoder("string-escape")
+ self.assertEquals(encoder(r'\x00')[1], 4)
+
# From http://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html
nameprep_tests = [
# 3.1 Map to nothing.
Library
-------
+- Fix codecs.escape_encode to return the correct consumed size.
+
- Issue #6470: Drop UNC prefix in FixTk.
- Issue #8833: tarfile created hard link entries with a size field != 0 by
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;
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