diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-07-11 20:29:08 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-07-12 07:27:07 -0600 |
commit | 05a15c8b621f953607429f3b67e079dfe1b439d6 (patch) | |
tree | c3c851bffa1d85399b4547f2a1620ad87c2c07bc /numpy/lib/utils.py | |
parent | a053a4372aba0af0bd63ffd5e207baf469cfc7bf (diff) | |
download | numpy-05a15c8b621f953607429f3b67e079dfe1b439d6.tar.gz |
MAINT: Remove uses of the WarningManager class.
WarningManager was a workaround for the lack of the with statement
in Python versions < 2.6. As those versions are no longer supported
it can be removed.
Deprecation notes are added to WarningManager and WarningMessage, but
to avoid a cascade of messages in third party apps, no warnings are
raised at this time, that can be done later.
Closes #3519.
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: |