Index: Modules/_pickle.c =================================================================== --- Modules/_pickle.c (revision 88420) +++ Modules/_pickle.c (working copy) @@ -4168,13 +4168,17 @@ return -1; } - if (_Unpickler_Read(self, &s, x) < 0) - return -1; + if (x == 0) + str = (PyObject *)_PyUnicode_New(0); + else { + if (_Unpickler_Read(self, &s, x) < 0) + return -1; - /* Convert Python 2.x strings to unicode. */ - str = PyUnicode_Decode(s, x, self->encoding, self->errors); - if (str == NULL) - return -1; + /* Convert Python 2.x strings to unicode. */ + str = PyUnicode_Decode(s, x, self->encoding, self->errors); + if (str == NULL) + return -1; + } PDATA_PUSH(self->stack, str, -1); return 0; @@ -4191,15 +4195,17 @@ return -1; x = (unsigned char)s[0]; - - if (_Unpickler_Read(self, &s, x) < 0) - return -1; - - /* Convert Python 2.x strings to unicode. */ - str = PyUnicode_Decode(s, x, self->encoding, self->errors); - if (str == NULL) - return -1; - + if (x == 0) + str = (PyObject *)_PyUnicode_New(0); + else { + if (_Unpickler_Read(self, &s, x) < 0) + return -1; + + /* Convert Python 2.x strings to unicode. */ + str = PyUnicode_Decode(s, x, self->encoding, self->errors); + if (str == NULL) + return -1; + } PDATA_PUSH(self->stack, str, -1); return 0; }