summaryrefslogtreecommitdiffstats
path: root/Lib/pickle.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-09-29 19:10:07 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-09-29 19:10:07 (GMT)
commite060619d4b047fdee613cafc64e3a9242a68ea54 (patch)
tree11c55e928773fe9e11be79432c5d28606290c137 /Lib/pickle.py
parentd455a50773eb1f4531882a0b99ff7a253ad1d41e (diff)
downloadcpython-e060619d4b047fdee613cafc64e3a9242a68ea54.zip
cpython-e060619d4b047fdee613cafc64e3a9242a68ea54.tar.gz
cpython-e060619d4b047fdee613cafc64e3a9242a68ea54.tar.bz2
Issue #25262. Added support for BINBYTES8 opcode in Python implementation of
unpickler. Highest 32 bits of 64-bit size for BINUNICODE8 and BINBYTES8 opcodes no longer silently ignored on 32-bit platforms in C implementation.
Diffstat (limited to 'Lib/pickle.py')
-rw-r--r--Lib/pickle.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/pickle.py b/Lib/pickle.py
index 67382ae..c7298af 100644
--- a/Lib/pickle.py
+++ b/Lib/pickle.py
@@ -1204,6 +1204,14 @@ class _Unpickler:
self.append(str(self.read(len), 'utf-8', 'surrogatepass'))
dispatch[BINUNICODE8[0]] = load_binunicode8
+ def load_binbytes8(self):
+ len, = unpack('<Q', self.read(8))
+ if len > maxsize:
+ raise UnpicklingError("BINBYTES8 exceeds system's maximum size "
+ "of %d bytes" % maxsize)
+ self.append(self.read(len))
+ dispatch[BINBYTES8[0]] = load_binbytes8
+
def load_short_binstring(self):
len = self.read(1)[0]
data = self.read(len)