summaryrefslogtreecommitdiff
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index e88a126eba..2bf48b756f 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -6798,7 +6798,7 @@ unicode_encode_ucs1(PyObject *unicode,
goto onError;
/* subtract preallocated bytes */
- writer.min_size -= 1;
+ writer.min_size -= newpos - collstart;
if (PyBytes_Check(rep)) {
/* Directly copy bytes result to output. */
@@ -6835,7 +6835,7 @@ unicode_encode_ucs1(PyObject *unicode,
ch = PyUnicode_READ_CHAR(rep, i);
if (ch >= limit) {
raise_encode_exception(&exc, encoding, unicode,
- pos, pos+1, reason);
+ collstart, collend, reason);
goto onError;
}
*str = (char)ch;