mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
- A new pickle protocol (protocol 3) is added with explicit support
for bytes. This is the default protocol. It intentionally cannot be unpickled by Python 2.x. - When a pickle written by Python 2.x contains an (8-bit) str instance, this is now decoded to a (Unicode) str instance. The encoding used to do this defaults to ASCII, but can be overridden via two new keyword arguments to the Unpickler class. Previously this would create bytes instances, which is usually wrong: str instances are often used to pickle attribute names etc., and text is more common than binary data anyway.
This commit is contained in:
parent
953e4e52c4
commit
f416981691
6 changed files with 165 additions and 55 deletions
|
@ -6,7 +6,7 @@ from test.pickletester import AbstractPickleModuleTests
|
|||
|
||||
class OptimizedPickleTests(AbstractPickleTests, AbstractPickleModuleTests):
|
||||
|
||||
def dumps(self, arg, proto=0, fast=0):
|
||||
def dumps(self, arg, proto=None):
|
||||
return pickletools.optimize(pickle.dumps(arg, proto))
|
||||
|
||||
def loads(self, buf):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue