summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-11-12 18:50:57 -0700
committerCharles Harris <charlesr.harris@gmail.com>2013-11-12 18:50:57 -0700
commitc002dc5101e932d3ff6e053c169c46d41f017cd9 (patch)
tree41eb2a12b95e7b602c3bcb212d9cb7ac9469ef57
parent3bf8706cefd28d33fb3ea1915d8a11f54ee7cfef (diff)
downloadnumpy-c002dc5101e932d3ff6e053c169c46d41f017cd9.tar.gz
BUG: Fix python 2.4 invalid use of try..finally.
In numpy/distutils/system_info.py
-rw-r--r--numpy/distutils/system_info.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
index 3ed78011a..08c5cd5a2 100644
--- a/numpy/distutils/system_info.py
+++ b/numpy/distutils/system_info.py
@@ -217,21 +217,22 @@ else:
import subprocess as sp
tmp = None
try:
- # Explicitly open/close file to avoid ResourceWarning when
- # tests are run in debug mode Python 3.
- tmp = open(os.devnull, 'w')
- p = sp.Popen(["gcc", "-print-multiarch"], stdout=sp.PIPE,
- stderr=tmp)
- except (OSError, DistutilsError):
- # OSError if gcc is not installed, or SandboxViolation (DistutilsError
- # subclass) if an old setuptools bug is triggered (see gh-3160).
- pass
- else:
- triplet = str(p.communicate()[0].decode().strip())
- if p.returncode == 0:
- # gcc supports the "-print-multiarch" option
- default_x11_lib_dirs += [os.path.join("/usr/lib/", triplet)]
- default_lib_dirs += [os.path.join("/usr/lib/", triplet)]
+ try:
+ # Explicitly open/close file to avoid ResourceWarning when
+ # tests are run in debug mode Python 3.
+ tmp = open(os.devnull, 'w')
+ p = sp.Popen(["gcc", "-print-multiarch"], stdout=sp.PIPE,
+ stderr=tmp)
+ except (OSError, DistutilsError):
+ # OSError if gcc is not installed, or SandboxViolation (DistutilsError
+ # subclass) if an old setuptools bug is triggered (see gh-3160).
+ pass
+ else:
+ triplet = str(p.communicate()[0].decode().strip())
+ if p.returncode == 0:
+ # gcc supports the "-print-multiarch" option
+ default_x11_lib_dirs += [os.path.join("/usr/lib/", triplet)]
+ default_lib_dirs += [os.path.join("/usr/lib/", triplet)]
finally:
if tmp is not None:
tmp.close()