summaryrefslogtreecommitdiff
path: root/numpy/__init__.py
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2020-05-14 14:27:29 -0500
committerSebastian Berg <sebastian@sipsolutions.net>2020-12-15 12:39:47 -0600
commit7628292e005fd3d6faf1b77434d2224921d49ad8 (patch)
tree8566c77c58f7780e663bc0a5c706b5f21d37536b /numpy/__init__.py
parent74e135b261e4613963cc50ddb97ac2edbd5936ba (diff)
downloadnumpy-7628292e005fd3d6faf1b77434d2224921d49ad8.tar.gz
DOC: Warn when reloading numpy or using numpy in sub-interpreter
This adds a warning when the main NumPy module is reloaded with the assumption that in this case objects such as `np.matrix`, `np._NoValue` or exceptions may be cached internally. It also gives a warning when NumPy is imported in a sub-interpreter.
Diffstat (limited to 'numpy/__init__.py')
-rw-r--r--numpy/__init__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py
index 879e8f013..a242bb7df 100644
--- a/numpy/__init__.py
+++ b/numpy/__init__.py
@@ -389,7 +389,12 @@ else:
# Note that this will currently only make a difference on Linux
core.multiarray._set_madvise_hugepage(use_hugepage)
+ # Give a warning if NumPy is reloaded or imported on a sub-interpreter
+ # We do this from python, since the C-module may not be reloaded and
+ # it is tidier organized.
+ core.multiarray._multiarray_umath._reload_guard()
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
+