summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/cjkcodecs/multibytecodec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/cjkcodecs/multibytecodec.c b/Modules/cjkcodecs/multibytecodec.c
index 77edbb3..6b23523 100644
--- a/Modules/cjkcodecs/multibytecodec.c
+++ b/Modules/cjkcodecs/multibytecodec.c
@@ -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) {