fix: explicit returns mixed with implicit (fall through) returns - #81
Merged
Merged
Conversation
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
ethanyzhang
marked this pull request as ready for review
March 20, 2026 21:35
ethanyzhang
requested review from
FelixYBW,
wanglinsong and
xpengahana
as code owners
March 20, 2026 21:35
ethanyzhang
added a commit
that referenced
this pull request
Apr 13, 2026
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In general, to fix mixed implicit/explicit returns, ensure every control path returns a value of the same type (or explicitly re-raises/propagates the error instead of returning). Here,
execute_mysql_queryexplicitly returns the fetched rows on success but implicitly returnsNoneon error. Without changing the external behavior too much, the cleanest approach is to make theexceptblock explicitly return a safe, consistent value—an empty list—after logging the error. This preserves the current “log and swallow” error-handling style while avoiding the confusingNonereturn.Concretely, in
benchmarks/scripts/mysql_utils.py, withinexecute_mysql_query, add areturn []statement inside theexcept Error as e:block, after theprint(f"The error '{e}' occurred")line. No imports or additional helper methods are required. All changes are confined to the shown function; the rest of the file and other imports remain untouched.Suggested fixes powered by Copilot Autofix. Review carefully before merging.