[Zope3-checkins] CVS: Zope3/src/zope/app - location.py:1.8

Fred L. Drake, Jr. fred at zope.com
Fri Feb 20 11:56:49 EST 2004


Update of /cvs-repository/Zope3/src/zope/app
In directory cvs.zope.org:/tmp/cvs-serv22445/src/zope/app

Modified Files:
	location.py 
Log Message:


revision 1.7.2.2
date: 2004/02/08 04:30:10;  author: jim;  state: Exp;  lines: +1 -1
Changed tests to not test pickle protocol 2.
Protocol 2 exposes a bug in Python 2.3.3 that causes weird
intermittent failures in Zope.



revision 1.7.2.1
date: 2004/02/01 15:07:18;  author: jim;  state: Exp;  lines: +7 -1
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.8 ===
--- Zope3/src/zope/app/location.py:1.7	Sun Dec  7 07:56:49 2003
+++ Zope3/src/zope/app/location.py	Fri Feb 20 11:56:48 2004
@@ -288,7 +288,7 @@
     persistent = CopyPersistent(loc)
 
     # Pickle the object to a temporary file
-    pickler = cPickle.Pickler(tmp, 2)
+    pickler = cPickle.Pickler(tmp, 1) # XXX disable until Python 2.3.4 
     pickler.persistent_id = persistent.id
     pickler.dump(loc)
 
@@ -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