From 7628292e005fd3d6faf1b77434d2224921d49ad8 Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Thu, 14 May 2020 14:27:29 -0500 Subject: 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. --- numpy/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'numpy/__init__.py') 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 + -- cgit v1.2.1