diff options
author | Alexandre Vassalotti <alexandre@peadrop.com> | 2011-12-13 18:22:42 (GMT) |
---|---|---|
committer | Alexandre Vassalotti <alexandre@peadrop.com> | 2011-12-13 18:22:42 (GMT) |
commit | a23d65ccfe3b8f618bf3dde4d0d27895e764367e (patch) | |
tree | d622378b5708429037e47b5759adf76525b502c4 /Lib/pickle.py | |
parent | ec51cf159f2e75d3bdab181877fc28137ce052ba (diff) | |
parent | 3bfc65a25ba2e010ef12db0cff006c2cbbeb18f9 (diff) | |
download | cpython-a23d65ccfe3b8f618bf3dde4d0d27895e764367e.zip cpython-a23d65ccfe3b8f618bf3dde4d0d27895e764367e.tar.gz cpython-a23d65ccfe3b8f618bf3dde4d0d27895e764367e.tar.bz2 |
Merge 3.2
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r-- | Lib/pickle.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py index ca36274..c01a6af 100644 --- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -485,7 +485,11 @@ class _Pickler: def save_bytes(self, obj, pack=struct.pack): if self.proto < 3: - self.save_reduce(bytes, (list(obj),), obj=obj) + if len(obj) == 0: + self.save_reduce(bytes, (), obj=obj) + else: + self.save_reduce(codecs.encode, + (str(obj, 'latin1'), 'latin1'), obj=obj) return n = len(obj) if n < 256: |