mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Merge 3.2
This commit is contained in:
commit
a23d65ccfe
5 changed files with 94 additions and 57 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue