diff options
Diffstat (limited to 'Lib/distutils/emxccompiler.py')
-rw-r--r-- | Lib/distutils/emxccompiler.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Lib/distutils/emxccompiler.py b/Lib/distutils/emxccompiler.py index f52e63232d..a0172058a3 100644 --- a/Lib/distutils/emxccompiler.py +++ b/Lib/distutils/emxccompiler.py @@ -272,8 +272,10 @@ def check_config_h(): # It would probably better to read single lines to search. # But we do this only once, and it is fast enough f = open(fn) - s = f.read() - f.close() + try: + s = f.read() + finally: + f.close() except IOError, exc: # if we can't read this file, we cannot say it is wrong @@ -300,8 +302,10 @@ def get_versions(): gcc_exe = find_executable('gcc') if gcc_exe: out = os.popen(gcc_exe + ' -dumpversion','r') - out_string = out.read() - out.close() + try: + out_string = out.read() + finally: + out.close() result = re.search('(\d+\.\d+\.\d+)',out_string) if result: gcc_version = StrictVersion(result.group(1)) |