diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-29 11:13:24 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-11-29 11:13:24 (GMT) |
commit | 3c49710e9fc383c521817cee3cb5d3695430b7ea (patch) | |
tree | 98964613377546034970a03969b032d603037e7f /Lib/test/test_pickle.py | |
parent | 15f070f8451db36d56bc3b99f14a6899b73cd305 (diff) | |
parent | 7279befccbd49fc6aa2f96c4b0dea1799695156d (diff) | |
download | cpython-3c49710e9fc383c521817cee3cb5d3695430b7ea.zip cpython-3c49710e9fc383c521817cee3cb5d3695430b7ea.tar.gz cpython-3c49710e9fc383c521817cee3cb5d3695430b7ea.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.py | 13 |
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 |