[Zope3-checkins] CVS: Zope3/src/zope/app - location.py:1.7.2.1
Jim Fulton
jim at zope.com
Sun Feb 1 10:07:19 EST 2004
Update of /cvs-repository/Zope3/src/zope/app
In directory cvs.zope.org:/tmp/cvs-serv1535/src/zope/app
Modified Files:
Tag: zope3-zodb3-devel-branch
location.py
Log Message:
Changed the persistent id generation code to always generate positive
ids. I found that the old scheme didn't work with the Python pickle
module due to, what I believe to be, a bug in pickle.py. pickle.py
checks to see whether the result of persistent_id is false, rather than
checking whether it is None.
=== Zope3/src/zope/app/location.py 1.7 => 1.7.2.1 ===
--- Zope3/src/zope/app/location.py:1.7 Sun Dec 7 07:56:49 2003
+++ Zope3/src/zope/app/location.py Sun Feb 1 10:07:18 2004
@@ -361,6 +361,12 @@
if id(object) in self.pids_by_id:
return self.pids_by_id[id(object)]
pid = len(self.others_by_pid)
+
+ # The following is needed to overcome a bug
+ # in pickle.py. The pickle checks the boolean value
+ # if the id, rather than whether it is None.
+ pid += 1
+
self.pids_by_id[id(object)] = pid
self.others_by_pid[pid] = object
return pid
More information about the Zope3-Checkins
mailing list