Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restrict SIM105 to try blocks with a body of one simple statement #1948

Merged
merged 1 commit into from
Jan 18, 2023

Commits on Jan 18, 2023

  1. Restrict SIM105 to try blocks with a body of one simple statement

    If a `try` block has multiple statements, a compound statement, or
    control flow, rewriting it with `contextlib.suppress` would obfuscate
    the fact that the exception still short-circuits further statements in
    the block.
    
    Fixes astral-sh#1947.
    
    Signed-off-by: Anders Kaseorg <andersk@mit.edu>
    andersk committed Jan 18, 2023
    Configuration menu
    Copy the full SHA
    285b157 View commit details
    Browse the repository at this point in the history