Index: Python/getargs.c =================================================================== --- Python/getargs.c (revision 43246) +++ Python/getargs.c (working copy) @@ -1041,7 +1041,7 @@ else { char *buf; Py_ssize_t count = convertbuffer(arg, p, &buf); - if (count < 0) + if (count < 0 || ((count % sizeof(Py_UNICODE)) != 0)) return converterr(buf, arg, msgbuf, bufsize); STORE_SIZE(count/(sizeof(Py_UNICODE))); } Index: Objects/unicodeobject.c =================================================================== --- Objects/unicodeobject.c (revision 43246) +++ Objects/unicodeobject.c (working copy) @@ -321,7 +321,7 @@ /* Single character Unicode objects in the Latin-1 range are shared when using this constructor */ - if (size == 1 && *u < 256) { + if (size == 1 && (unsigned) *u < 256) { unicode = unicode_latin1[*u]; if (!unicode) { unicode = _PyUnicode_New(1);