Skip to content

Fix bare except clause in gooey/python_bindings/argparse_to_json.py - #949

Open
koteshyelamati wants to merge 1 commit into
chriskiehl:masterfrom
koteshyelamati:master
Open

Fix bare except clause in gooey/python_bindings/argparse_to_json.py#949
koteshyelamati wants to merge 1 commit into
chriskiehl:masterfrom
koteshyelamati:master

Conversation

@koteshyelamati

Copy link
Copy Markdown

Replace bare except: with except (AttributeError, TypeError): in iter_parsers() in gooey/python_bindings/argparse_to_json.py (line 162).

The function calls get_subparser(parser._actions).choices.items() and falls back to a default iterator on failure. The possible exceptions are AttributeError (if .choices doesn't exist on the subparser) or TypeError (if .items() isn't callable). Using a specific exception type avoids silently swallowing unexpected errors like SystemExit or KeyboardInterrupt.

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