summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index a149177..beafaa4 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4474,8 +4474,16 @@ utf7Error:
/* return state */
if (consumed) {
if (inShift) {
- outpos = shiftOutStart; /* back off output */
*consumed = startinpos;
+ if (outpos != shiftOutStart &&
+ PyUnicode_MAX_CHAR_VALUE(unicode) > 127) {
+ PyObject *result = PyUnicode_FromKindAndData(
+ PyUnicode_KIND(unicode), PyUnicode_DATA(unicode),
+ shiftOutStart);
+ Py_DECREF(unicode);
+ unicode = result;
+ }
+ outpos = shiftOutStart; /* back off output */
}
else {
*consumed = s-starts;