From: Guido van Rossum Date: Thu, 19 Jul 2007 22:19:35 +0000 (+0000) Subject: Fix test_pickle, by reverting the string opcodes (S, T, U) to returning X-Git-Tag: v3.0a1~613 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f93254d2992896445cbd1eec0ee4a80eb8edc6b8;p=python Fix test_pickle, by reverting the string opcodes (S, T, U) to returning strings, in Latin-1. Bytes are once more pickled through bytes.__reduce__, but now it returns "latin-1" as the second parameter. Unfortunately this breaks datetime pickling. I'll have to investigate further; reverting Martin's changes doesn't seem to help. --- diff --git a/Lib/pickle.py b/Lib/pickle.py index c158b8da0f..9570dd422d 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -506,20 +506,6 @@ class Pickler: self.memoize(obj) dispatch[str8] = save_string - def save_bytes(self, obj): - # Like save_string - if self.bin: - n = len(obj) - if n < 256: - self.write(SHORT_BINSTRING + bytes([n]) + bytes(obj)) - else: - self.write(BINSTRING + pack("ob_type, self->ob_bytes == NULL ? "" : self->ob_bytes, - self->ob_size); + self->ob_size, + "latin-1"); } static PySequenceMethods bytes_as_sequence = {