Skip to content

fix: replace bare except with Exception in check-docker.py#11069

Open
harshadkhetpal wants to merge 1 commit intolablup:mainfrom
harshadkhetpal:fix/bare-except-check-docker
Open

fix: replace bare except with Exception in check-docker.py#11069
harshadkhetpal wants to merge 1 commit intolablup:mainfrom
harshadkhetpal:fix/bare-except-check-docker

Conversation

@harshadkhetpal
Copy link
Copy Markdown

Summary

Replaces bare except: clauses with except Exception: in scripts/check-docker.py.

Motivation

Bare except: catches BaseException, which includes KeyboardInterrupt and SystemExit. This can mask critical signals like Ctrl-C and make debugging harder. PEP 8 flags this as E722.

Change

# Before
try:
    ...
except:
    ...

# After
try:
    ...
except Exception:
    ...

Testing

No behavior change for normal error paths — only behavior change is that KeyboardInterrupt/SystemExit now propagate as intended.

Bare except clauses catch BaseException, including KeyboardInterrupt
and SystemExit, which is almost never intended. This change uses the
more specific `except Exception:` to avoid swallowing system-level
exceptions (PEP 8 E722).
@cla-assistant
Copy link
Copy Markdown

cla-assistant bot commented Apr 14, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@cla-assistant
Copy link
Copy Markdown

cla-assistant bot commented Apr 14, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Comment thread scripts/check-docker.py
try:
r.raise_for_status()
except:
except BaseException:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

except BaseException is effectively the same as a bare except:. it catches everything including KeyboardInterrupt, SystemExit, and GeneratorExit.
Since the intent here is to handle HTTP/request errors, this should be except Exception: instead, so that system-level signals can still propagate normally.

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