summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2005-03-05 04:22:52 (GMT)
committerSteven Knight <knight@baldmt.com>2005-03-05 04:22:52 (GMT)
commit7504c9d138b5a0a43c75918dc39614af12a7439a (patch)
tree08e143a02354454101a6bb0678618e90d67ce82e /src
parent93f3f5bfacb423243a4f8a1ab2d55a0452d51db5 (diff)
downloadSCons-7504c9d138b5a0a43c75918dc39614af12a7439a.zip
SCons-7504c9d138b5a0a43c75918dc39614af12a7439a.tar.gz
SCons-7504c9d138b5a0a43c75918dc39614af12a7439a.tar.bz2
Fix stack trace when there's no scanner in an Environment.
Diffstat (limited to 'src')
-rw-r--r--src/engine/SCons/Environment.py6
-rw-r--r--src/engine/SCons/EnvironmentTests.py6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py
index 10787a7..2f11f06 100644
--- a/src/engine/SCons/Environment.py
+++ b/src/engine/SCons/Environment.py
@@ -569,12 +569,10 @@ class Base(SubstitutionEnvironment):
def get_scanner(self, skey):
"""Find the appropriate scanner given a key (usually a file suffix).
- __cacheable__
"""
sm = self._gsm()
- if sm.has_key(skey):
- return sm[skey]
- return None
+ try: return sm[skey]
+ except (KeyError, TypeError): return None
def _smd(self):
"__reset_cache__"
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py
index bfd1262..1772407 100644
--- a/src/engine/SCons/EnvironmentTests.py
+++ b/src/engine/SCons/EnvironmentTests.py
@@ -708,6 +708,12 @@ class BaseTestCase(unittest.TestCase):
suffixes = [".c", ".cc", ".cxx", ".m4", ".m5"]
+ env = Environment()
+ try: del env['SCANNERS']
+ except KeyError: pass
+ s = map(env.get_scanner, suffixes)
+ assert s == [None, None, None, None, None], s
+
env = Environment(SCANNERS = [])
s = map(env.get_scanner, suffixes)
assert s == [None, None, None, None, None], s