summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Scanner/C.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/SCons/Scanner/C.py')
-rw-r--r--src/engine/SCons/Scanner/C.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/engine/SCons/Scanner/C.py b/src/engine/SCons/Scanner/C.py
index 3b34b88..c2e50a6 100644
--- a/src/engine/SCons/Scanner/C.py
+++ b/src/engine/SCons/Scanner/C.py
@@ -58,12 +58,11 @@ class SConsCPPScanner(SCons.cpp.PreProcessor):
return result
def read_file(self, file):
try:
- fp = open(str(file.rfile()))
+ with open(str(file.rfile())) as fp:
+ return fp.read()
except EnvironmentError as e:
self.missing.append((file, self.current_file))
return ''
- else:
- return fp.read()
def dictify_CPPDEFINES(env):
cppdefines = env.get('CPPDEFINES', {})