diff -r 1be8cd7cee92 Objects/unicodeobject.c --- a/Objects/unicodeobject.c Sun Oct 09 15:37:43 2016 +0300 +++ b/Objects/unicodeobject.c Sun Oct 09 23:41:36 2016 +0800 @@ -2113,6 +2113,11 @@ { const unsigned char *s = (const unsigned char *)buffer; PyObject *unicode; + + assert(size >= 0); + if (size == 0) { + _Py_RETURN_UNICODE_EMPTY(); + } if (size == 1) { #ifdef Py_DEBUG assert((unsigned char)s[0] < 128);