Kaydet (Commit) 9a80faba authored tarafından Victor Stinner's avatar Victor Stinner

MultibyteCodec_Encode() checks if PyUnicode_AS_UNICODE() failed

üst 9e30aa52
...@@ -574,8 +574,11 @@ MultibyteCodec_Encode(MultibyteCodecObject *self, ...@@ -574,8 +574,11 @@ MultibyteCodec_Encode(MultibyteCodecObject *self,
} }
} }
data = PyUnicode_AS_UNICODE(arg); data = PyUnicode_AsUnicodeAndSize(arg, &datalen);
datalen = PyUnicode_GET_SIZE(arg); if (data == NULL) {
Py_XDECREF(ucvt);
return NULL;
}
errorcb = internal_error_callback(errors); errorcb = internal_error_callback(errors);
if (errorcb == NULL) { 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