[Zope-Checkins] CVS: ZODB3/ZODB - utils.py:1.20

Tim Peters tim.one at comcast.net
Mon Dec 29 16:24:18 EST 2003


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv19467/ZODB

Modified Files:
	utils.py 
Log Message:
Removed legacy [Uup]64 code (for use under Pythons before 2.2).


=== ZODB3/ZODB/utils.py 1.19 => 1.20 ===
--- ZODB3/ZODB/utils.py:1.19	Fri Nov 28 11:44:49 2003
+++ ZODB3/ZODB/utils.py	Mon Dec 29 16:24:16 2003
@@ -22,48 +22,20 @@
 z64 = '\0'*8
 t32 = 1L << 32
 
-if sys.hexversion >= 0x02020000:
+assert sys.hexversion >= 0x02020000
 
-    # Note that the distinction between ints and longs is blurred in
-    # Python 2.2.  So make u64() and U64() the same.
+# The distinction between ints and longs is blurred in Python 2.2,
+# so u64() are U64() really the same.
 
-    def p64(v):
-        """Pack an integer or long into a 8-byte string"""
-        return pack(">Q", v)
+def p64(v):
+    """Pack an integer or long into a 8-byte string"""
+    return pack(">Q", v)
 
-    def u64(v):
-        """Unpack an 8-byte string into a 64-bit long integer."""
-        return unpack(">Q", v)[0]
+def u64(v):
+    """Unpack an 8-byte string into a 64-bit long integer."""
+    return unpack(">Q", v)[0]
 
-    U64 = u64
-
-else:
-
-    def p64(v):
-        """Pack an integer or long into a 8-byte string"""
-        if v < t32:
-            h = 0
-        else:
-            h, v = divmod(v, t32)
-        return pack(">II", h, v)
-
-    def u64(v):
-        """Unpack an 8-byte string into a 64-bit (or long) integer."""
-        h, v = unpack(">ii", v)
-        if v < 0:
-            v = t32 + v
-        if h:
-            if h < 0:
-                h= t32 + h
-            v = (long(h) << 32) + v
-        return v
-
-    def U64(v):
-        """Same as u64 but always returns a long."""
-        h, v = unpack(">II", v)
-        if h:
-            v = (long(h) << 32) + v
-        return v
+U64 = u64
 
 def cp(f1, f2, l):
     read = f1.read




More information about the Zope-Checkins mailing list