Commit 06205d74 authored by Jason Madden's avatar Jason Madden

For pypy, set the persistent_id attribute of the pickler, since it uses a...

For pypy, set the persistent_id attribute of the pickler, since it uses a python implementation even in Py2
parent 1cdf9a75
...@@ -175,6 +175,11 @@ class ObjectWriter: ...@@ -175,6 +175,11 @@ class ObjectWriter:
self._p = Pickler(self._file, _protocol) self._p = Pickler(self._file, _protocol)
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
self._p.inst_persistent_id = self.persistent_id 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: else:
self._p.persistent_id = self.persistent_id self._p.persistent_id = self.persistent_id
self._stack = [] self._stack = []
......
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