Skip to content

fix: replace bare except with except Exception in autoconf#3421

Merged
TheophileDiot merged 1 commit intobunkerity:devfrom
harshadkhetpal:fix/bare-except-autoconf-main
Apr 9, 2026
Merged

fix: replace bare except with except Exception in autoconf#3421
TheophileDiot merged 1 commit intobunkerity:devfrom
harshadkhetpal:fix/bare-except-autoconf-main

Conversation

@harshadkhetpal
Copy link
Copy Markdown

Summary

Replace bare except: clause with except Exception: in src/autoconf/main.py (PEP 8 E722).

Why: Bare except: catches all exceptions including SystemExit, KeyboardInterrupt, and GeneratorExit. Since this block logs the error and exits, except Exception: properly scopes it to application-level exceptions only.

Change:

# Before (line 85)
except:
    LOGGER.error(f"Exception while running autoconf :\n{format_exc()}")

# After
except Exception:
    LOGGER.error(f"Exception while running autoconf :\n{format_exc()}")

Testing

No behavior change for normal operation — only prevents accidentally swallowing system-level exceptions.

@TheophileDiot TheophileDiot changed the base branch from master to dev April 9, 2026 13:40
Copy link
Copy Markdown
Member

@TheophileDiot TheophileDiot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TheophileDiot
Copy link
Copy Markdown
Member

Nice catch @harshadkhetpal !

@TheophileDiot TheophileDiot merged commit 09a1eda into bunkerity:dev Apr 9, 2026
1 check passed
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