diff options
-rw-r--r-- | numpy/core/__init__.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/numpy/core/__init__.py b/numpy/core/__init__.py index 41314cee4..16dcbe0b1 100644 --- a/numpy/core/__init__.py +++ b/numpy/core/__init__.py @@ -6,15 +6,16 @@ from numpy.version import version as __version__ # disables OpenBLAS affinity setting of the main thread that limits # python threads or processes to one core import os -envbak = os.environ.copy() -if 'OPENBLAS_MAIN_FREE' not in os.environ: - os.environ['OPENBLAS_MAIN_FREE'] = '1' -if 'GOTOBLAS_MAIN_FREE' not in os.environ: - os.environ['GOTOBLAS_MAIN_FREE'] = '1' +env_added = [] +for envkey in ['OPENBLAS_MAIN_FREE', 'GOTOBLAS_MAIN_FREE']: + if envkey not in os.environ: + os.environ[envkey] = '1' + env_added.append(envkey) from . import multiarray -os.environ.clear() -os.environ.update(envbak) -del envbak +for envkey in env_added: + del os.environ[envkey] +del envkey +del env_added del os from . import umath |