summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-10-15 18:25:59 +0300
committerSerhiy Storchaka <storchaka@gmail.com>2017-10-15 19:01:26 +0300
commit03644830d59f1ed43a9b64e9a48ccea1fec012a2 (patch)
tree390a656926d5612a60cafbaceca5a652c4f64123
parent56a29d2ca6f9543240a755bf9e4312b1467fe59b (diff)
downloadnumpy-03644830d59f1ed43a9b64e9a48ccea1fec012a2.tar.gz
BUG: Restore the environment variables when import multiarray fails.
The environment variables are modified before importing multiarray and restored when the import is done. But when the import fails the environment varibles were left changed.
-rw-r--r--numpy/core/__init__.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/numpy/core/__init__.py b/numpy/core/__init__.py
index 5ad27fbe1..6db484de4 100644
--- a/numpy/core/__init__.py
+++ b/numpy/core/__init__.py
@@ -24,9 +24,9 @@ files not under version control). Otherwise reinstall numpy.
Original error was: %s
""" % (exc,)
raise ImportError(msg)
-
-for envkey in env_added:
- del os.environ[envkey]
+finally:
+ for envkey in env_added:
+ del os.environ[envkey]
del envkey
del env_added
del os