[Python-checkins] cpython (merge 3.4 -> default): Issue #23094: Fixed readline with frames in Python implementation of pickle.
serhiy.storchaka
python-checkins at python.org
Mon Jan 26 09:39:44 CET 2015
https://hg.python.org/cpython/rev/c347c21e5afa
changeset: 94297:c347c21e5afa
parent: 94294:1db1cd711104
parent: 94296:d5e13b74d377
user: Serhiy Storchaka <storchaka at gmail.com>
date: Mon Jan 26 10:37:44 2015 +0200
summary:
Issue #23094: Fixed readline with frames in Python implementation of pickle.
files:
Lib/pickle.py | 2 +-
Lib/test/pickletester.py | 8 ++++++++
Misc/NEWS | 2 ++
3 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/Lib/pickle.py b/Lib/pickle.py
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -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 --git a/Lib/test/pickletester.py b/Lib/test/pickletester.py
--- a/Lib/test/pickletester.py
+++ b/Lib/test/pickletester.py
@@ -1584,6 +1584,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 --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -218,6 +218,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
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list