diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2022-10-01 02:55:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-30 17:55:12 -0700 |
commit | b654752c240936596d23b5bfb2e00d2bacbcf50f (patch) | |
tree | 34bc886274f31fd7b22fbd3033e01f9201c1cbea /numpy/lib/utils.py | |
parent | 1260b5293f8efacaa902fe33d6dc82d3ddc638bb (diff) | |
download | numpy-b654752c240936596d23b5bfb2e00d2bacbcf50f.tar.gz |
REV: Losen `lookfor`'s import try/except again (#22356)
Some BaseExceptions (at least the Skipped that pytest uses) need to
be caught as well. It seems easiest to be practical and keep ignoring
almost all exception in this particular code path.
Effectively reverts parts of gh-19393
Closes gh-22345
Co-authored-by: Sebastian Berg <sebastianb@nvidia.com>
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r-- | numpy/lib/utils.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/lib/utils.py b/numpy/lib/utils.py index 497827e75..f9d29e89d 100644 --- a/numpy/lib/utils.py +++ b/numpy/lib/utils.py @@ -972,8 +972,12 @@ def _lookfor_generate_cache(module, import_modules, regenerate): finally: sys.stdout = old_stdout sys.stderr = old_stderr - # Catch SystemExit, too - except (Exception, SystemExit): + except KeyboardInterrupt: + # Assume keyboard interrupt came from a user + raise + except BaseException: + # Ignore also SystemExit and pytests.importorskip + # `Skipped` (these are BaseExceptions; gh-22345) continue for n, v in _getmembers(item): |