summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-01 20:30:50 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-03-01 20:30:50 (GMT)
commit3d9d77a3dc1f38791e734f079afa2ed57b1278f9 (patch)
treed0526a24634ef185b30bf040bc8de50d952e5fda /Objects
parent42e49ac0da5849cdca269fb2747f9faf5b6c7d0c (diff)
parent6c9aa8f2bf46e28de74ce11d85bcd448c0d0d529 (diff)
downloadcpython-3d9d77a3dc1f38791e734f079afa2ed57b1278f9.zip
cpython-3d9d77a3dc1f38791e734f079afa2ed57b1278f9.tar.gz
cpython-3d9d77a3dc1f38791e734f079afa2ed57b1278f9.tar.bz2
Merge 3.5
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index ab80e24..c4cca6f 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -8783,7 +8783,8 @@ unicode_fast_translate_lookup(PyObject *mapping, Py_UCS1 ch,
translated into writer, raise an exception and return -1 on error. */
static int
unicode_fast_translate(PyObject *input, PyObject *mapping,
- _PyUnicodeWriter *writer, int ignore)
+ _PyUnicodeWriter *writer, int ignore,
+ Py_ssize_t *input_pos)
{
Py_UCS1 ascii_table[128], ch, ch2;
Py_ssize_t len;
@@ -8830,6 +8831,7 @@ unicode_fast_translate(PyObject *input, PyObject *mapping,
exit:
writer->pos = out - PyUnicode_1BYTE_DATA(writer->buffer);
+ *input_pos = in - PyUnicode_1BYTE_DATA(input);
return res;
}
@@ -8875,7 +8877,7 @@ _PyUnicode_TranslateCharmap(PyObject *input,
ignore = (errors != NULL && strcmp(errors, "ignore") == 0);
- res = unicode_fast_translate(input, mapping, &writer, ignore);
+ res = unicode_fast_translate(input, mapping, &writer, ignore, &i);
if (res < 0) {
_PyUnicodeWriter_Dealloc(&writer);
return NULL;
@@ -8883,7 +8885,6 @@ _PyUnicode_TranslateCharmap(PyObject *input,
if (res == 1)
return _PyUnicodeWriter_Finish(&writer);
- i = writer.pos;
while (i<size) {
/* try to encode it */
int translate;