[Zope-CVS] CVS: Products/Ape/lib/apelib/zodb3 - serializers.py:1.3 storage.py:1.8

Shane Hathaway shane at zope.com
Tue Sep 16 17:00:08 EDT 2003


Update of /cvs-repository/Products/Ape/lib/apelib/zodb3
In directory cvs.zope.org:/tmp/cvs-serv321/lib/apelib/zodb3

Modified Files:
	serializers.py storage.py 
Log Message:
Fixed Python 2.3 compatibility.

- If you append to a list while it is being pickled, Python 2.3 will pick up
  the new items.  Previous versions of Python did not.

- Fixed a FutureWarning about ('%x' % n) where n < 0.  The solution, in this
  case, is to add 2L ** 32 to n.



=== Products/Ape/lib/apelib/zodb3/serializers.py 1.2 => 1.3 ===
--- Products/Ape/lib/apelib/zodb3/serializers.py:1.2	Wed Jul  9 11:40:12 2003
+++ Products/Ape/lib/apelib/zodb3/serializers.py	Tue Sep 16 17:00:07 2003
@@ -243,6 +243,7 @@
                 # Couldn't help.
                 raise
 
+        p.persistent_id = lambda ob: None  # Stop recording references
         p.dump(unmanaged)
         s = outfile.getvalue()
         event.addUnmanagedPersistentObjects(unmanaged)


=== Products/Ape/lib/apelib/zodb3/storage.py 1.7 => 1.8 ===
--- Products/Ape/lib/apelib/zodb3/storage.py:1.7	Wed Jul 30 17:33:12 2003
+++ Products/Ape/lib/apelib/zodb3/storage.py	Tue Sep 16 17:00:07 2003
@@ -85,7 +85,11 @@
     def hash64(self, value):
         """Returns an 8-byte hash value.
         """
-        h = '%08x' % hash(value)
+        v = hash(value)
+        if v < 0:
+            # Treat the hash as an unsigned 32-bit integer
+            v += 2L ** 32
+        h = '%08x' % v
         if h == HASH0:
             # Avoid the special zero hash.
             h = HASH1




More information about the Zope-CVS mailing list