diff options
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r-- | numpy/lib/utils.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index f19a47176..f54946722 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -1107,18 +1107,14 @@ def safe_eval(source): """ # Local imports to speed up numpy's import time. import warnings - from numpy.testing.utils import WarningManager - warn_ctx = WarningManager() - warn_ctx.__enter__() - try: + + with warnings.catch_warnings(): # compiler package is deprecated for 3.x, which is already solved here warnings.simplefilter('ignore', DeprecationWarning) try: import compiler except ImportError: import ast as compiler - finally: - warn_ctx.__exit__() walker = SafeEval() try: |