[Zodb-checkins] SVN: ZODB/trunk/src/ Merge rev 30984 from 3.4 branch.

Tim Peters tim.one at comcast.net
Sat Jul 2 19:33:09 EDT 2005


Log message for revision 30987:
  Merge rev 30984 from 3.4 branch.
  
  Get rid of all code defining or referencing t32.
  
  Such code never made sense; it was all of the form
  
      t32 = 1L << 32
      if something < 0:
          something = t32 - something
  
  which is a way to change negative integers into
  gigantic positive integers greater than 4 billion, and
  never made sense in context.  Possibly
  
          something = t32 + something
  
  was intended, but that never made sense in context either.
  
  In any case, `something` is invariably obtained from
  struct.unpack using the "H" format code, and that never
  returns a negative integer to begin with.
  

Changed:
  U   ZODB/trunk/src/ZODB/FileStorage/FileStorage.py
  U   ZODB/trunk/src/ZODB/FileStorage/format.py
  U   ZODB/trunk/src/ZODB/fsrecover.py
  U   ZODB/trunk/src/ZODB/utils.py
  U   ZODB/trunk/src/scripts/fstest.py

-=-
Modified: ZODB/trunk/src/ZODB/FileStorage/FileStorage.py
===================================================================
--- ZODB/trunk/src/ZODB/FileStorage/FileStorage.py	2005-07-02 23:30:37 UTC (rev 30986)
+++ ZODB/trunk/src/ZODB/FileStorage/FileStorage.py	2005-07-02 23:33:08 UTC (rev 30987)
@@ -42,8 +42,6 @@
 from ZODB.loglevels import BLATHER
 from ZODB.fsIndex import fsIndex
 
-t32 = 1L << 32
-
 packed_version = "FS21"
 
 logger = logging.getLogger('ZODB.FileStorage')
@@ -1653,8 +1651,6 @@
             break
 
         tid, tl, status, ul, dl, el = unpack(TRANS_HDR, h)
-        if el < 0: 
-            el = t32 - el
 
         if tid <= ltid:
             logger.warning("%s time-stamp reduction at %s", name, pos)

Modified: ZODB/trunk/src/ZODB/FileStorage/format.py
===================================================================
--- ZODB/trunk/src/ZODB/FileStorage/format.py	2005-07-02 23:30:37 UTC (rev 30986)
+++ ZODB/trunk/src/ZODB/FileStorage/format.py	2005-07-02 23:33:08 UTC (rev 30987)
@@ -127,7 +127,7 @@
 import logging
 
 from ZODB.POSException import POSKeyError
-from ZODB.utils import u64, oid_repr, t32
+from ZODB.utils import u64, oid_repr
 
 
 class CorruptedError(Exception):
@@ -342,8 +342,7 @@
         self.ulen = ulen
         self.dlen = dlen
         self.elen = elen
-        if elen < 0:
-            self.elen = t32 - elen
+        assert elen >= 0
 
     def asString(self):
         s = struct.pack(TRANS_HDR, self.tid, self.tlen, self.status,

Modified: ZODB/trunk/src/ZODB/fsrecover.py
===================================================================
--- ZODB/trunk/src/ZODB/fsrecover.py	2005-07-02 23:30:37 UTC (rev 30986)
+++ ZODB/trunk/src/ZODB/fsrecover.py	2005-07-02 23:33:08 UTC (rev 30987)
@@ -81,7 +81,7 @@
     import ZODB
 
 import ZODB.FileStorage
-from ZODB.utils import t32, u64
+from ZODB.utils import u64
 from ZODB.FileStorage import RecordIterator
 
 from persistent.TimeStamp import TimeStamp
@@ -108,8 +108,6 @@
         raise EOFError
 
     tid, stl, status, ul, dl, el = unpack(">8s8scHHH",h)
-    if el < 0: el=t32-el
-
     tl = u64(stl)
 
     if pos + (tl + 8) > file_size:

Modified: ZODB/trunk/src/ZODB/utils.py
===================================================================
--- ZODB/trunk/src/ZODB/utils.py	2005-07-02 23:30:37 UTC (rev 30986)
+++ ZODB/trunk/src/ZODB/utils.py	2005-07-02 23:33:08 UTC (rev 30987)
@@ -25,7 +25,6 @@
 from persistent.TimeStamp import TimeStamp
 
 __all__ = ['z64',
-           't32',
            'p64',
            'u64',
            'U64',
@@ -60,16 +59,6 @@
 
 z64 = '\0'*8
 
-# TODO The purpose of t32 is unclear.  Code that uses it is usually
-# of the form:
-#
-#    if e < 0:
-#        e = t32 - e
-#
-# Doesn't make sense (since e is negative, it creates a number larger than
-# t32).  If users said "e += t32", *maybe* it would make sense.
-t32 = 1L << 32
-
 assert sys.hexversion >= 0x02030000
 
 # The distinction between ints and longs is blurred in Python 2.2,

Modified: ZODB/trunk/src/scripts/fstest.py
===================================================================
--- ZODB/trunk/src/scripts/fstest.py	2005-07-02 23:30:37 UTC (rev 30986)
+++ ZODB/trunk/src/scripts/fstest.py	2005-07-02 23:33:08 UTC (rev 30987)
@@ -117,8 +117,6 @@
         raise FormatError("%s truncated at %s" % (path, pos))
 
     tid, stl, status, ul, dl, el = struct.unpack(">8s8scHHH", h)
-    if el < 0:
-        el = t32 - el
     tmeta_len = TREC_HDR_LEN + ul + dl + el
 
     if tid <= ltid:



More information about the Zodb-checkins mailing list