We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9b5deeb commit 4a4b9ffCopy full SHA for 4a4b9ff
1 file changed
Objects/unicodeobject.c
@@ -6221,14 +6221,13 @@ _PyUnicode_EncodeUTF32(PyObject *str,
6221
Py_CLEAR(rep);
6222
}
6223
6224
+ Py_XDECREF(errorHandler);
6225
+ Py_XDECREF(exc);
6226
+
6227
/* Cut back to size actually needed. This is necessary for, for example,
6228
encoding of a string containing isolated surrogates and the 'ignore'
6229
handler is used. */
- nsize = (unsigned char*) out - (unsigned char*) PyBytesWriter_GetData(writer);
- PyObject *bytes = PyBytesWriter_FinishWithSize(writer, nsize);
- Py_XDECREF(errorHandler);
6230
- Py_XDECREF(exc);
6231
- return bytes;
+ return PyBytesWriter_FinishWithPointer(writer, out);
6232
6233
error:
6234
Py_XDECREF(rep);
0 commit comments