changeset: 94296:d5e13b74d377 branch: 3.4 parent: 94293:04fa56628830 user: Serhiy Storchaka date: Mon Jan 26 10:37:01 2015 +0200 files: Lib/pickle.py Lib/test/pickletester.py Misc/NEWS description: Issue #23094: Fixed readline with frames in Python implementation of pickle. diff -r 04fa56628830 -r d5e13b74d377 Lib/pickle.py --- a/Lib/pickle.py Mon Jan 26 10:26:14 2015 +0200 +++ b/Lib/pickle.py Mon Jan 26 10:37:01 2015 +0200 @@ -242,7 +242,7 @@ if not data: self.current_frame = None return self.file_readline() - if data[-1] != b'\n': + if data[-1] != b'\n'[0]: raise UnpicklingError( "pickle exhausted before end of frame") return data diff -r 04fa56628830 -r d5e13b74d377 Lib/test/pickletester.py --- a/Lib/test/pickletester.py Mon Jan 26 10:26:14 2015 +0200 +++ b/Lib/test/pickletester.py Mon Jan 26 10:37:01 2015 +0200 @@ -1538,6 +1538,14 @@ 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.' + # 0: \x80 PROTO 4 + # 2: \x95 FRAME 5 + # 11: I INT 42 + # 15: . STOP + self.assertEqual(self.loads(pickled), 42) + def test_nested_names(self): global Nested class Nested: diff -r 04fa56628830 -r d5e13b74d377 Misc/NEWS --- a/Misc/NEWS Mon Jan 26 10:26:14 2015 +0200 +++ b/Misc/NEWS Mon Jan 26 10:37:01 2015 +0200 @@ -50,6 +50,8 @@ Library ------- +- Issue #23094: Fixed readline with frames in Python implementation of pickle. + - Issue #23268: Fixed bugs in the comparison of ipaddress classes. - Issue #21408: Removed incorrect implementations of __ne__() which didn't