From f93254d2992896445cbd1eec0ee4a80eb8edc6b8 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 19 Jul 2007 22:19:35 +0000 Subject: 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. --- Lib/pickle.py | 20 +++----------------- Objects/bytesobject.c | 8 +++----- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/Lib/pickle.py b/Lib/pickle.py index c158b8d..9570dd4 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 = { -- cgit v0.12