diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2015-10-13 14:21:31 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-10-13 14:21:31 -0600 |
commit | 0d30809a3348eb85f6cdd761c62d497dee48b2c8 (patch) | |
tree | 679b84f8272228982d2496febc0af3929b44dabb | |
parent | 0f0474e5c1bd159fac53c0f056c7c18c605cd0dd (diff) | |
parent | 48a105538a02344d5b7ecc2eb74e6126dd097f6c (diff) | |
download | numpy-0d30809a3348eb85f6cdd761c62d497dee48b2c8.tar.gz |
Merge pull request #6460 from behrisch/minimize_os_environ_adaptions
BUG: Replacing the os.environ.clear by less invasive procedure
-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 |