summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pickle.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-11-29 11:14:00 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-11-29 11:14:00 (GMT)
commit92d5fbaf8f6c3c3c8ab0c83be848fcc206f02b22 (patch)
tree9774820134d340203b550ef2bd999f03be77d6e5 /Lib/test/test_pickle.py
parent40062a1127a9678669bb0efec89d015bbbed1836 (diff)
parent3c49710e9fc383c521817cee3cb5d3695430b7ea (diff)
downloadcpython-92d5fbaf8f6c3c3c8ab0c83be848fcc206f02b22.zip
cpython-92d5fbaf8f6c3c3c8ab0c83be848fcc206f02b22.tar.gz
cpython-92d5fbaf8f6c3c3c8ab0c83be848fcc206f02b22.tar.bz2
Issue #25761: Added more test cases for testing unpickling broken data.
Output raised exception at verbose level 2 (-vv).
Diffstat (limited to 'Lib/test/test_pickle.py')
-rw-r--r--Lib/test/test_pickle.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py
index b13e3b1..bd38cfb 100644
--- a/Lib/test/test_pickle.py
+++ b/Lib/test/test_pickle.py
@@ -33,6 +33,11 @@ class PyUnpicklerTests(AbstractUnpickleTests):
unpickler = pickle._Unpickler
bad_stack_errors = (IndexError,)
+ bad_mark_errors = (IndexError, pickle.UnpicklingError,
+ TypeError, AttributeError, EOFError)
+ truncated_errors = (pickle.UnpicklingError, EOFError,
+ AttributeError, ValueError,
+ struct.error, IndexError, ImportError)
def loads(self, buf, **kwds):
f = io.BytesIO(buf)
@@ -64,6 +69,11 @@ class InMemoryPickleTests(AbstractPickleTests, AbstractUnpickleTests,
pickler = pickle._Pickler
unpickler = pickle._Unpickler
bad_stack_errors = (pickle.UnpicklingError, IndexError)
+ bad_mark_errors = (pickle.UnpicklingError, IndexError,
+ TypeError, AttributeError, EOFError)
+ truncated_errors = (pickle.UnpicklingError, EOFError,
+ AttributeError, ValueError,
+ struct.error, IndexError, ImportError)
def dumps(self, arg, protocol=None):
return pickle.dumps(arg, protocol)
@@ -122,6 +132,9 @@ if has_c_implementation:
class CUnpicklerTests(PyUnpicklerTests):
unpickler = _pickle.Unpickler
bad_stack_errors = (pickle.UnpicklingError,)
+ bad_mark_errors = (EOFError,)
+ truncated_errors = (pickle.UnpicklingError, EOFError,
+ AttributeError, ValueError)
class CPicklerTests(PyPicklerTests):
pickler = _pickle.Pickler