mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #11564: Avoid crashes when trying to pickle huge objects or containers
(more than 2**31 items). Instead, in most cases, an OverflowError is raised.
This commit is contained in:
parent
aa26b27503
commit
82be19f889
5 changed files with 217 additions and 81 deletions
|
@ -7,6 +7,7 @@ from test.pickletester import AbstractPickleTests
|
|||
from test.pickletester import AbstractPickleModuleTests
|
||||
from test.pickletester import AbstractPersistentPicklerTests
|
||||
from test.pickletester import AbstractPicklerUnpicklerObjectTests
|
||||
from test.pickletester import BigmemPickleTests
|
||||
|
||||
try:
|
||||
import _pickle
|
||||
|
@ -37,13 +38,13 @@ class PyPicklerTests(AbstractPickleTests):
|
|||
return u.load()
|
||||
|
||||
|
||||
class InMemoryPickleTests(AbstractPickleTests):
|
||||
class InMemoryPickleTests(AbstractPickleTests, BigmemPickleTests):
|
||||
|
||||
pickler = pickle._Pickler
|
||||
unpickler = pickle._Unpickler
|
||||
|
||||
def dumps(self, arg, proto=None):
|
||||
return pickle.dumps(arg, proto)
|
||||
def dumps(self, arg, protocol=None):
|
||||
return pickle.dumps(arg, protocol)
|
||||
|
||||
def loads(self, buf, **kwds):
|
||||
return pickle.loads(buf, **kwds)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue