Skip to content

fix: replace bare except with except Exception in utils.py - #2103

Closed
koteshyelamati wants to merge 1 commit into
davidhalter:masterfrom
koteshyelamati:master
Closed

fix: replace bare except with except Exception in utils.py#2103
koteshyelamati wants to merge 1 commit into
davidhalter:masterfrom
koteshyelamati:master

Conversation

@koteshyelamati

Copy link
Copy Markdown

Bare except: clauses catch BaseException, which includes KeyboardInterrupt, SystemExit, and GeneratorExit. This means a Ctrl+C during REPL tab completion would be caught and logged as a "REPL Completion error" rather than propagating naturally.

Replace with except Exception: to catch only programmatic errors while allowing keyboard interrupts and system exits to propagate as expected.

Change:

# Before
except:
    logging.error("REPL Completion error:\n" + traceback.format_exc())
    raise

# After
except Exception:
    logging.error("REPL Completion error:\n" + traceback.format_exc())
    raise

@davidhalter

davidhalter commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Did you use LLMs to fix this? This does not make sense. I'm happy to explain why if you did not use LLMs for this.

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