8000 Merge pull request #22387 from charris/backport-22356 · numpy/numpy@a35df7c · GitHub
[go: up one dir, main page]

Skip to content

Commit a35df7c

Browse files
authored
Merge pull request #22387 from charris/backport-22356
REV: Loosen ``lookfor``'s import try/except again
2 parents 611fadc + 6b08030 commit a35df7c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

numpy/lib/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,8 +907,12 @@ def _lookfor_generate_cache(module, import_modules, regenerate):
907907
finally:
908908
sys.stdout = old_stdout
909909
sys.stderr = old_stderr
910-
# Catch SystemExit, too
911-
except (Exception, SystemExit):
910+
except KeyboardInterrupt:
911+
# Assume keyboard interrupt came from a user
912+
raise
913+
except BaseException:
914+
# Ignore also SystemExit and pytests.importorskip
915+
# `Skipped` (these are BaseExceptions; gh-22345)
912916
continue
913917

914918
for n, v in _getmembers(item):

0 commit comments

Comments
 (0)
0