summaryrefslogtreecommitdiff
path: root/numpy/lib/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/utils.py')
-rw-r--r--numpy/lib/utils.py8
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):