Commit 28ea4d28 authored by Tres Seaver's avatar Tres Seaver

Fix 'get_pickle_metadata' for protocol > 1 on Python2.

parent 8ae7a5c1
...@@ -217,8 +217,9 @@ def get_pickle_metadata(data): ...@@ -217,8 +217,9 @@ def get_pickle_metadata(data):
# ZODB's data records contain two pickles. The first is the class # ZODB's data records contain two pickles. The first is the class
# of the object, the second is the object. We're only trying to # of the object, the second is the object. We're only trying to
# pick apart the first here, to extract the module and class names. # pick apart the first here, to extract the module and class names.
if data[0] == 0x80: # protocol marker, protocol > 1 if data[0] in (0x80, # Py3k indexes bytes -> int
protocol = data[1] b'\x80' # Python2 indexes bytes -> bytes
): # protocol marker, protocol > 1
data = data[2:] data = data[2:]
if data.startswith(b'(c'): # pickle MARK GLOBAL opcode sequence if data.startswith(b'(c'): # pickle MARK GLOBAL opcode sequence
global_prefix = 2 global_prefix = 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment