Skip to content

fix: replace bare except with except Exception in _logger.py - #1497

Open
TrueFurina wants to merge 1 commit into
Delgan:masterfrom
TrueFurina:master
Open

fix: replace bare except with except Exception in _logger.py#1497
TrueFurina wants to merge 1 commit into
Delgan:masterfrom
TrueFurina:master

Conversation

@TrueFurina

Copy link
Copy Markdown

Summary

In the async-generator context manager (loguru/_logger.py), a bare
except: re-raises after the StopAsyncIteration case is handled. A bare
except also catches KeyboardInterrupt/SystemExit before re-raising them,
which is unnecessary and hides intent.

Replace with except Exception: — behavior is identical (the handler always
re-raises), but only expected exceptions are intercepted.

Verification

  • python -m py_compile loguru/_logger.py → OK
  • grep -rn "except:" loguru/ → 0 remaining bare handlers

Files changed

  • loguru/_logger.py (1 line)

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