Skip to content

Fix bare except: use specific exception types#14000

Open
koteshyelamati wants to merge 2 commits into
explosion:masterfrom
koteshyelamati:master
Open

Fix bare except: use specific exception types#14000
koteshyelamati wants to merge 2 commits into
explosion:masterfrom
koteshyelamati:master

Conversation

@koteshyelamati

Copy link
Copy Markdown

Replace bare except: clauses with specific exception types:

  • spacy/ml/callbacks.py: except Exception: (guards inspect.signature() which can fail for Cython methods)
  • spacy/cli/_util.py: except Exception: (guards run_command("git --version"))

Bare except: catches BaseException including SystemExit and KeyboardInterrupt.

Handle exceptions specifically when setting function signature.
Catch specific exceptions when running git command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant