diff options
Diffstat (limited to 'numpy/__init__.py')
| -rw-r--r-- | numpy/__init__.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py index 976062d13..9fd7717a9 100644 --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -122,10 +122,6 @@ except NameError: if __NUMPY_SETUP__: sys.stderr.write('Running from numpy source directory.\n') else: - # Make variable available during multiarray/C initialization - import os - _numpy2_behavior = os.environ.get("NPY_NUMPY_2_BEHAVIOR", "0") != "0" - try: from numpy.__config__ import show as show_config except ImportError as e: @@ -396,6 +392,7 @@ else: # is slow and thus better avoided. # Specifically kernel version 4.6 had a bug fix which probably fixed this: # https://github.com/torvalds/linux/commit/7cf91a98e607c2f935dbcc177d70011e95b8faff + import os use_hugepage = os.environ.get("NUMPY_MADVISE_HUGEPAGE", None) if sys.platform == "linux" and use_hugepage is None: # If there is an issue with parsing the kernel version, @@ -426,8 +423,9 @@ else: core.multiarray._multiarray_umath._reload_guard() # default to "weak" promotion for "NumPy 2". - core._set_promotion_state(os.environ.get( - "NPY_PROMOTION_STATE", "weak" if _numpy2_behavior else "legacy")) + core._set_promotion_state( + os.environ.get("NPY_PROMOTION_STATE", + "weak" if _using_numpy2_behavior() else "legacy")) # Tell PyInstaller where to find hook-numpy.py def _pyinstaller_hooks_dir(): |
