Merge 3.2

This commit is contained in:
Alexandre Vassalotti 2011-12-13 13:22:42 -05:00
commit a23d65ccfe
5 changed files with 94 additions and 57 deletions

View file

@ -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: