Commit e94fd70b authored by Victor Stinner's avatar Victor Stinner

MultibyteCodec_Encode() checks if PyUnicode_AS_UNICODE() failed

parent ca8cc12c
......@@ -574,8 +574,11 @@ MultibyteCodec_Encode(MultibyteCodecObject *self,
}
}
data = PyUnicode_AS_UNICODE(arg);
datalen = PyUnicode_GET_SIZE(arg);
data = PyUnicode_AsUnicodeAndSize(arg, &datalen);
if (data == NULL) {
Py_XDECREF(ucvt);
return NULL;
}
errorcb = internal_error_callback(errors);
if (errorcb == NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment