Skip to content

Commit

Permalink
For pypy, set the persistent_id attribute of the pickler, since it us…
Browse files Browse the repository at this point in the history
…es a python implementation even in Py2
  • Loading branch information
jamadden committed Feb 18, 2014
1 parent 1cdf9a7 commit 06205d7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ZODB/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ def __init__(self, obj=None):
self._p = Pickler(self._file, _protocol)
if sys.version_info[0] < 3:
self._p.inst_persistent_id = self.persistent_id
# PyPy uses a python implementation of cPickle in both Python 2
# and Python 3. We can't really detect inst_persistent_id as its
# a magic attribute that's not readable, but it doesn't hurt to
# simply always assign to persistent_id also
self._p.persistent_id = self.persistent_id
else:
self._p.persistent_id = self.persistent_id
self._stack = []
Expand Down

0 comments on commit 06205d7

Please sign in to comment.