summaryrefslogtreecommitdiffstats
path: root/Objects/unicodeobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r--Objects/unicodeobject.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 0460d18..087cfca 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -6813,8 +6813,6 @@ unicode_encode_ucs1(PyObject *unicode,
str = _PyBytesWriter_WriteBytes(&writer, str,
PyBytes_AS_STRING(rep),
PyBytes_GET_SIZE(rep));
- if (str == NULL)
- goto onError;
}
else {
assert(PyUnicode_Check(rep));
@@ -6836,6 +6834,9 @@ unicode_encode_ucs1(PyObject *unicode,
PyUnicode_DATA(rep),
PyUnicode_GET_LENGTH(rep));
}
+ if (str == NULL)
+ goto onError;
+
pos = newpos;
Py_CLEAR(rep);
}