zopefoundation/ZODB — pull request #17 by jamadden (2014-02-18 21:09:16+00:00)
Title: Set the persistent_id attribute of the pickler even under Py2 for PyPy

I've been working on getting `zope.container` usable under with PyPy. The test cases for `zope.container` make heavy use of ZODB and persistent objects. PyPy's implementation of cPickle is actually written in Python, so it doesn't have the `inst_persistent_id` attribute under Python 2. Instead, it always has and uses the `persistent_id` attribute; if only the `inst_persistent_id` value is set, then PyPy's pickler will never write out persistent ids correctly.

This commit causes `ZODB.serialize.ObjectWriter` to also set the `persistent_id` attribute. This lets the `zope.container` tests pass under PyPy, and doesn't break any of the tests for ZODB under cPython 2.6 or 2.7.