Skip to content

Commit

Permalink
Fix 'get_pickle_metadata' for protocol > 1 on Python2.
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Jun 8, 2013
1 parent 8ae7a5c commit 28ea4d2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ZODB/utils.py
Expand Up @@ -217,8 +217,9 @@ def get_pickle_metadata(data):
# 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
# pick apart the first here, to extract the module and class names.
if data[0] == 0x80: # protocol marker, protocol > 1
protocol = data[1]
if data[0] in (0x80, # Py3k indexes bytes -> int
b'\x80' # Python2 indexes bytes -> bytes
): # protocol marker, protocol > 1
data = data[2:]
if data.startswith(b'(c'): # pickle MARK GLOBAL opcode sequence
global_prefix = 2
Expand Down

0 comments on commit 28ea4d2

Please sign in to comment.