return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(_PyUnicode_EncodeUTF7(str, 0, 0, errors),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) == -1)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(PyUnicode_AsEncodedString(str, "utf-8", errors),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(_PyUnicode_EncodeUTF16(str, errors, byteorder),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(_PyUnicode_EncodeUTF16(str, errors, -1),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(_PyUnicode_EncodeUTF16(str, errors, +1),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(_PyUnicode_EncodeUTF32(str, errors, byteorder),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(_PyUnicode_EncodeUTF32(str, errors, -1),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(_PyUnicode_EncodeUTF32(str, errors, +1),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(PyUnicode_AsUnicodeEscapeString(str),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(PyUnicode_AsRawUnicodeEscapeString(str),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(_PyUnicode_AsLatin1String(str, errors),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(_PyUnicode_AsASCIIString(str, errors),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
mapping = NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(_PyUnicode_EncodeCharmap(str, mapping, errors),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(PyUnicode_EncodeCodePage(CP_ACP, str, errors),
PyUnicode_GET_LENGTH(str));
Py_DECREF(str);
return NULL;
str = PyUnicode_FromObject(str);
- if (str == NULL || PyUnicode_READY(str) < 0)
+ if (str == NULL || PyUnicode_READY(str) < 0) {
+ Py_XDECREF(str);
return NULL;
+ }
v = codec_tuple(PyUnicode_EncodeCodePage(code_page,
str,
errors),