Skip to content

Commit 4fcea6d

Browse files
authored
Merge pull request numpy#19393 from wandrewjam/remove-base-exception
MAINT: fix overly broad exception handling listed in LGTM
2 parents e69faef + 84498b0 commit 4fcea6d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

numpy/lib/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ def _lookfor_generate_cache(module, import_modules, regenerate):
904904
sys.stdout = old_stdout
905905
sys.stderr = old_stderr
906906
# Catch SystemExit, too
907-
except BaseException:
907+
except (Exception, SystemExit):
908908
continue
909909

910910
for n, v in _getmembers(item):

numpy/linalg/lapack_lite/make_lite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ def scrubF2CSource(c_file):
275275
def ensure_executable(name):
276276
try:
277277
which(name)
278-
except:
279-
raise SystemExit(name + ' not found')
278+
except Exception as ex:
279+
raise SystemExit(name + ' not found') from ex
280280

281281
def create_name_header(output_dir):
282282
routine_re = re.compile(r'^ (subroutine|.* function)\s+(\w+)\(.*$',

0 commit comments

Comments
 (0)