Skip to content

Conversation

@latifbaihaki
Copy link

This change replaces the bare except clause with an explicit BaseException
handler for better code clarity and to avoid potential issues with
sys.exc_info().

The previous code used a bare except: clause with sys.exc_info()[1] which
is discouraged in Python. This change makes the exception handling more
explicit by catching BaseException directly, which includes KeyboardInterrupt
and SystemExit that should not be handled by the normal exception handler.

All existing tests pass successfully.

Replace bare except clause with explicit BaseException handler for
better code clarity and to avoid potential issues with sys.exc_info().

The previous code used a bare except: clause with sys.exc_info()[1]
which is discouraged in Python. This change makes the exception
handling more explicit by catching BaseException directly, which
includes KeyboardInterrupt and SystemExit that should not be
handled by the normal exception handler.

Changes:
- Replace bare except: with except BaseException as e:
- Add explanatory comment about BaseException handling
- Remove noqa: B001 comment as it's no longer needed

All existing tests pass successfully.
@davidism davidism closed this Dec 22, 2025
@latifbaihaki latifbaihaki deleted the fix/improve-exception-handler branch December 22, 2025 02:41
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants