---
 yum/misc.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/yum/misc.py b/yum/misc.py
index 15e571f..8e81c34 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -252,6 +252,9 @@ class Checksums:
     def __len__(self):
         return self._len
 
+    # Note that len(x) is assert limited to INT_MAX, which is 2GB on i686.
+    length = property(fget=lambda self: self._len)
+
     def update(self, data):
         self._len += len(data)
         for sumalgo in self._sumalgos:
@@ -323,7 +326,7 @@ def checksum(sumtype, file, CHUNK=2**16, datasize=None):
 
         data = Checksums([sumtype])
         while data.read(fo, CHUNK):
-            if datasize is not None and len(data) > datasize:
+            if datasize is not None and data.length > datasize:
                 break
 
         if type(file) is types.StringType:
@@ -332,7 +335,7 @@ def checksum(sumtype, file, CHUNK=2**16, datasize=None):
             
         # This screws up the length, but that shouldn't matter. We only care
         # if this checksum == what we expect.
-        if datasize is not None and datasize != len(data):
+        if datasize is not None and datasize != data.length:
             return '!%u!%s' % (datasize, data.hexdigest(sumtype))
 
         return data.hexdigest(sumtype)
-- 
1.7.3.4

_______________________________________________
Yum-devel mailing list
Yum-devel@lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to