◐ Shell
clean mode source ↗

[3.7] bpo-31829: Make protocol 0 pickles be loadable in text mode in Python 2. (GH-11859) by miss-islington · Pull Request #13693 · python/cpython

Expand Up @@ -2709,22 +2709,20 @@ def __getattr__(self, key): class AbstractPickleModuleTests(unittest.TestCase):
def test_dump_closed_file(self): import os f = open(TESTFN, "wb") try: f.close() self.assertRaises(ValueError, self.dump, 123, f) finally: os.remove(TESTFN) support.unlink(TESTFN)
def test_load_closed_file(self): import os f = open(TESTFN, "wb") try: f.close() self.assertRaises(ValueError, self.dump, 123, f) finally: os.remove(TESTFN) support.unlink(TESTFN)
def test_load_from_and_dump_to_file(self): stream = io.BytesIO() Expand All @@ -2748,6 +2746,19 @@ def test_callapi(self): self.Pickler(f, -1) self.Pickler(f, protocol=-1)
def test_dump_text_file(self): f = open(TESTFN, "w") try: for proto in protocols: self.assertRaises(TypeError, self.dump, 123, f, proto) finally: f.close() support.unlink(TESTFN)
def test_incomplete_input(self): s = io.BytesIO(b"X''.") self.assertRaises((EOFError, struct.error, pickle.UnpicklingError), self.load, s)
def test_bad_init(self): # Test issue3664 (pickle can segfault from a badly initialized Pickler). # Override initialization without calling __init__() of the superclass. Expand Down