summaryrefslogtreecommitdiffstats
path: root/Lib/test/pickletester.py
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-07-23 19:26:02 (GMT)
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2009-07-23 19:26:02 (GMT)
commit74b301678315068f4e1283fadcc5232cc94426ca (patch)
tree82d97fa060675f230739859b2f800b47b6afae3a /Lib/test/pickletester.py
parent617a5588d1e5d0ad4cf791646c053064df74aea2 (diff)
downloadcpython-74b301678315068f4e1283fadcc5232cc94426ca.zip
cpython-74b301678315068f4e1283fadcc5232cc94426ca.tar.gz
cpython-74b301678315068f4e1283fadcc5232cc94426ca.tar.bz2
#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.
Diffstat (limited to 'Lib/test/pickletester.py')
-rw-r--r--Lib/test/pickletester.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 7306aa8..8f96d74 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -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()