summaryrefslogtreecommitdiff
path: root/numpy/lib/utils.py
diff options
context:
space:
mode:
authorRalf Gommers <ralf.gommers@googlemail.com>2013-07-16 12:28:18 -0700
committerRalf Gommers <ralf.gommers@googlemail.com>2013-07-16 12:28:18 -0700
commitc067c156bf2ffb96d93083e468158ecbc35baba4 (patch)
treeb73812a3a1a95a044c07c6352b5e254ffd792793 /numpy/lib/utils.py
parentb55f2752140de3bd6969dd66960f649da44974a5 (diff)
parent05a15c8b621f953607429f3b67e079dfe1b439d6 (diff)
downloadnumpy-c067c156bf2ffb96d93083e468158ecbc35baba4.tar.gz
Merge pull request #3520 from charris/replace-warningmanager
Replace use of WarningManager by warnings.catch_warnings and then deprecate it.
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r--numpy/lib/utils.py8
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: