From 86b4b76e5949e1ad7d8b67f19d2cd2b6dfab38b6 Mon Sep 17 00:00:00 2001 From: Kotesh Kumar Yelamati Date: Sun, 19 Jul 2026 17:59:19 -0400 Subject: [PATCH 1/2] Fix bare except: replace with except Exception: in callbacks.py Handle exceptions specifically when setting function signature. --- spacy/ml/callbacks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/ml/callbacks.py b/spacy/ml/callbacks.py index d9976cea80..39ba8227db 100644 --- a/spacy/ml/callbacks.py +++ b/spacy/ml/callbacks.py @@ -90,7 +90,7 @@ def pipes_with_nvtx_range( # the original parameters are passed to pydantic for validation downstream. try: wrapped_func.__signature__ = inspect.signature(func) # type: ignore - except: + except Exception: # Can fail for Cython methods that do not have bindings. warnings.warn(Warnings.W122.format(method=name, pipe=pipe.name)) continue From ab1f89f8191b983ff7001c6c0f46cc78775d47b9 Mon Sep 17 00:00:00 2001 From: Kotesh Kumar Yelamati Date: Sun, 19 Jul 2026 18:00:04 -0400 Subject: [PATCH 2/2] Fix bare except: replace with except Exception: in cli/_util.py Catch specific exceptions when running git command. --- spacy/cli/_util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/cli/_util.py b/spacy/cli/_util.py index 757c418440..24573d7148 100644 --- a/spacy/cli/_util.py +++ b/spacy/cli/_util.py @@ -206,7 +206,7 @@ def get_git_version( """ try: ret = run_command("git --version", capture=True) - except: + except Exception: raise RuntimeError(error) stdout = ret.stdout.strip() if not stdout or not stdout.startswith("git version"):