Skip to content

Fix bare except clauses in tests/test_formatters.py and tests/simpleerr.py#15318

Draft
koteshyelamati wants to merge 2 commits into
ipython:mainfrom
koteshyelamati:main
Draft

Fix bare except clauses in tests/test_formatters.py and tests/simpleerr.py#15318
koteshyelamati wants to merge 2 commits into
ipython:mainfrom
koteshyelamati:main

Conversation

@koteshyelamati

Copy link
Copy Markdown

Replace bare except: clauses with specific exception types.

Changes:

  • tests/test_formatters.py: except ImportError: for the import numpy guard
  • tests/simpleerr.py: except ValueError: when parsing int(sys.argv[2])

Bare except: catches BaseException subclasses (including KeyboardInterrupt, SystemExit). These specific types match the actual exceptions raised by the guarded code.

@Carreau

Carreau commented Jul 23, 2026

Copy link
Copy Markdown
Member

can you please look at the test failures ?

@Carreau
Carreau marked this pull request as draft July 23, 2026 13:48
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.

2 participants