cpython: c347c21e5afa (original) (raw)
Mercurial > cpython
changeset 94297:c347c21e5afa
Issue #23094: Fixed readline with frames in Python implementation of pickle. [#23094]
Serhiy Storchaka storchaka@gmail.com | |
---|---|
date | Mon, 26 Jan 2015 10:37:44 +0200 |
parents | 1db1cd711104(current diff)d5e13b74d377(diff) |
children | b31dae6f3364 b0a686260b5d |
files | Lib/test/pickletester.py Misc/NEWS |
diffstat | 3 files changed, 11 insertions(+), 1 deletions(-)[+] [-] Lib/pickle.py 2 Lib/test/pickletester.py 8 Misc/NEWS 2 |
line wrap: on
line diff
--- a/Lib/pickle.py +++ b/Lib/pickle.py @@ -242,7 +242,7 @@ class _Unframer: if not data: self.current_frame = None return self.file_readline()
if data[-1] != b'\n':[](#l1.7)
if data[-1] != b'\n'[0]:[](#l1.8) raise UnpicklingError([](#l1.9) "pickle exhausted before end of frame")[](#l1.10) return data[](#l1.11)
--- a/Lib/test/pickletester.py +++ b/Lib/test/pickletester.py @@ -1584,6 +1584,14 @@ class AbstractPickleTests(unittest.TestC count_opcode(pickle.FRAME, pickled)) self.assertEqual(obj, self.loads(some_frames_pickle))
- def test_frame_readline(self):
pickled = b'\x80\x04\x95\x05\x00\x00\x00\x00\x00\x00\x00I42\n.'[](#l2.8)
# 0: \x80 PROTO 4[](#l2.9)
# 2: \x95 FRAME 5[](#l2.10)
# 11: I INT 42[](#l2.11)
# 15: . STOP[](#l2.12)
self.assertEqual(self.loads(pickled), 42)[](#l2.13)
+ def test_nested_names(self): global Nested class Nested:
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -218,6 +218,8 @@ Core and Builtins Library ------- +- Issue #23094: Fixed readline with frames in Python implementation of pickle. +