summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/pickletester.py4
-rw-r--r--Lib/test/test_pickle.py12
-rw-r--r--Lib/test/test_pickletools.py4
3 files changed, 12 insertions, 8 deletions
diff --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
index 3ae7def..a843486 100644
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -1093,6 +1093,10 @@ class AbstractPickleTests(unittest.TestCase):
self.assertEqual(len(loaded), len(data))
self.assertEqual(loaded, data)
+ def test_empty_bytestring(self):
+ # issue 11286
+ empty = self.loads(b'\x80\x03U\x00q\x00.', encoding='koi8-r')
+ self.assertEqual(empty, '')
# Test classes for reduce_ex
diff --git a/Lib/test/test_pickle.py b/Lib/test/test_pickle.py
index 7f642c8..a3878fd 100644
--- a/Lib/test/test_pickle.py
+++ b/Lib/test/test_pickle.py
@@ -31,9 +31,9 @@ class PyPicklerTests(AbstractPickleTests):
f.seek(0)
return bytes(f.read())
- def loads(self, buf):
+ def loads(self, buf, **kwds):
f = io.BytesIO(buf)
- u = self.unpickler(f)
+ u = self.unpickler(f, **kwds)
return u.load()
@@ -45,8 +45,8 @@ class InMemoryPickleTests(AbstractPickleTests):
def dumps(self, arg, proto=None):
return pickle.dumps(arg, proto)
- def loads(self, buf):
- return pickle.loads(buf)
+ def loads(self, buf, **kwds):
+ return pickle.loads(buf, **kwds)
class PyPersPicklerTests(AbstractPersistentPicklerTests):
@@ -64,12 +64,12 @@ class PyPersPicklerTests(AbstractPersistentPicklerTests):
f.seek(0)
return f.read()
- def loads(self, buf):
+ def loads(self, buf, **kwds):
class PersUnpickler(self.unpickler):
def persistent_load(subself, obj):
return self.persistent_load(obj)
f = io.BytesIO(buf)
- u = PersUnpickler(f)
+ u = PersUnpickler(f, **kwds)
return u.load()
diff --git a/Lib/test/test_pickletools.py b/Lib/test/test_pickletools.py
index 823b0c2..d37ac26 100644
--- a/Lib/test/test_pickletools.py
+++ b/Lib/test/test_pickletools.py
@@ -9,8 +9,8 @@ class OptimizedPickleTests(AbstractPickleTests, AbstractPickleModuleTests):
def dumps(self, arg, proto=None):
return pickletools.optimize(pickle.dumps(arg, proto))
- def loads(self, buf):
- return pickle.loads(buf)
+ def loads(self, buf, **kwds):
+ return pickle.loads(buf, **kwds)
# Test relies on precise output of dumps()
test_pickle_to_2x = None