[SDK] Replace bare except with explicit BaseException catch by cf3901646 · Pull Request #10165 · mlrun/mlrun · GitHub
Skip to content

[SDK] Replace bare except with explicit BaseException catch - #10165

Open
cf3901646 wants to merge 1 commit into
mlrun:developmentfrom
cf3901646:fix/issue-9860-auto
Open

cf3901646 wants to merge 1 commit into
mlrun:developmentfrom
cf3901646:fix/issue-9860-auto

Conversation

@cf3901646

@cf3901646 cf3901646 commented Oct 19, 2026 •

Copy link
Copy Markdown

Summary of Changes

Fixed a bare \except:\ clause in \mlrun/datastore/model_provider/openai_provider.py\ that was catching \BaseException\ implicitly. This anti-pattern is flagged by Ruff rule E722 and can cause subtle issues. The change replaces \except:\ with \except BaseException:\ to preserve the exact same behavior (including catching \�syncio.CancelledError) while making the intent clear and satisfying linting requirements.

Motivation & Context

Closes #9860

The bare \except:\ clause was catching \BaseException\ implicitly, which includes \KeyboardInterrupt, \SystemExit, and \�syncio.CancelledError. While the code re-raises the exception, using a bare \except:\ is a Python anti-pattern and makes the intent unclear. The fix ensures that the code continues to cancel all sibling tasks when any task fails, including cancellation signals, while being explicit about what is being caught.

Verification

  • Python syntax validated via py_compile
  • Confirmed \except BaseException:\ cleanly catches \�syncio.CancelledError\ and sibling exceptions before cancelling remaining tasks and re-raising
  • Complies with Ruff E722

@cf3901646
cf3901646 requested a review from a team as a code owner October 19, 2026 08:53
@cf3901646 cf3901646 changed the title fix(openai_provider): replace bare except with explicit BaseException catch [SDK] Replace bare except with explicit BaseException catch Oct 19, 2026
@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Bare except clause in openai_provider async gather swallows BaseException signals

1 participant