Skip to content

Commit

Permalink
REV: Losen lookfor's import try/except again (#22356)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
seberg and seberg committed Oct 1, 2022
1 parent 1260b52 commit b654752
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions numpy/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit b654752

Please sign in to comment.