summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Sig
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-11-09 03:11:32 (GMT)
committerSteven Knight <knight@baldmt.com>2003-11-09 03:11:32 (GMT)
commitb2256bb0f8e1e0f5822d250b58ff123349e58df5 (patch)
tree0544ff0d91f9cbe5bb1e29c2911c962bcdff8c00 /src/engine/SCons/Sig
parentb7308d19648bda8220d69328de74dfcad9a28872 (diff)
downloadSCons-b2256bb0f8e1e0f5822d250b58ff123349e58df5.zip
SCons-b2256bb0f8e1e0f5822d250b58ff123349e58df5.tar.gz
SCons-b2256bb0f8e1e0f5822d250b58ff123349e58df5.tar.bz2
Don't swallow the AttributeError for an expansion like .bak.
Diffstat (limited to 'src/engine/SCons/Sig')
-rw-r--r--src/engine/SCons/Sig/MD5.py4
-rw-r--r--src/engine/SCons/Sig/MD5Tests.py13
2 files changed, 15 insertions, 2 deletions
diff --git a/src/engine/SCons/Sig/MD5.py b/src/engine/SCons/Sig/MD5.py
index c50dbb7..21cb24c 100644
--- a/src/engine/SCons/Sig/MD5.py
+++ b/src/engine/SCons/Sig/MD5.py
@@ -79,10 +79,10 @@ def signature(obj):
"""Generate a signature for an object
"""
try:
- contents = str(obj.get_contents())
+ gc = obj.get_contents
except AttributeError:
raise AttributeError, "unable to fetch contents of '%s'" % str(obj)
- return hexdigest(md5.new(contents).digest())
+ return hexdigest(md5.new(str(gc())).digest())
def to_string(signature):
"""Convert a signature to a string"""
diff --git a/src/engine/SCons/Sig/MD5Tests.py b/src/engine/SCons/Sig/MD5Tests.py
index 6285e87..67bdfc9 100644
--- a/src/engine/SCons/Sig/MD5Tests.py
+++ b/src/engine/SCons/Sig/MD5Tests.py
@@ -88,6 +88,19 @@ class MD5TestCase(unittest.TestCase):
else:
raise AttributeError, "unexpected get_contents() attribute"
+ # Make sure we don't eat AttributeErrors raised internally
+ # by the get_contents() method (or anything it calls).
+ caught = None
+ try:
+ class xxx:
+ def get_contents(self):
+ raise AttributeError, "internal AttributeError"
+ signature(xxx())
+ except AttributeError, e:
+ assert str(e) == "internal AttributeError", e
+ caught = 1
+ assert caught, "did not catch expected AttributeError"
+
def test_to_string(self):
assert '698d51a19d8a121ce581499d7b701668' == to_string('698d51a19d8a121ce581499d7b701668')