summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2011-12-13 18:22:42 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2011-12-13 18:22:42 (GMT)
commita23d65ccfe3b8f618bf3dde4d0d27895e764367e (patch)
treed622378b5708429037e47b5759adf76525b502c4 /Lib/pickle.py
parentec51cf159f2e75d3bdab181877fc28137ce052ba (diff)
parent3bfc65a25ba2e010ef12db0cff006c2cbbeb18f9 (diff)
downloadcpython-a23d65ccfe3b8f618bf3dde4d0d27895e764367e.zip
cpython-a23d65ccfe3b8f618bf3dde4d0d27895e764367e.tar.gz
cpython-a23d65ccfe3b8f618bf3dde4d0d27895e764367e.tar.bz2
Merge 3.2
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py6
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: