mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
#6553: crash in cPickle.load(), when given a StringIO with incomplete data.
Will backport to 2.6, 3.x already fixed a similar issue with issue4298.
This commit is contained in:
parent
617a5588d1
commit
74b3016783
3 changed files with 16 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
import unittest
|
||||
import pickle
|
||||
import cPickle
|
||||
import StringIO
|
||||
import cStringIO
|
||||
import pickletools
|
||||
import copy_reg
|
||||
|
@ -1086,6 +1087,10 @@ class AbstractPickleModuleTests(unittest.TestCase):
|
|||
self.module.Pickler(f, -1)
|
||||
self.module.Pickler(f, protocol=-1)
|
||||
|
||||
def test_incomplete_input(self):
|
||||
s = StringIO.StringIO("X''.")
|
||||
self.assertRaises(EOFError, self.module.load, s)
|
||||
|
||||
class AbstractPersistentPicklerTests(unittest.TestCase):
|
||||
|
||||
# This class defines persistent_id() and persistent_load()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue