Skip to content

tools: avoid returning from finally blocks#19314

Open
Old-Ding wants to merge 1 commit into
apache:masterfrom
Old-Ding:codex/python-return-finally-warnings
Open

tools: avoid returning from finally blocks#19314
Old-Ding wants to merge 1 commit into
apache:masterfrom
Old-Ding:codex/python-return-finally-warnings

Conversation

@Old-Ding

@Old-Ding Old-Ding commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Move two Python returns out of finally blocks.
  • Keep normal return values unchanged while avoiding suppression of unexpected exceptions.

Testing

  • python -We compile check for tools/ci/testrun/utils/common.py and tools/pynuttx/nxgdb/net.py
  • git show --check --stat --oneline HEAD

@github-actions github-actions Bot added Area: CI Size: XS The size of the change in this PR is very small labels Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@Old-Ding Old-Ding force-pushed the codex/python-return-finally-warnings branch from f3f25cc to 4bc62ce Compare July 8, 2026 03:40
Python warns about return statements inside finally blocks because they
can suppress pending exceptions. Move the returns after the try/finally
and try/except bodies so normal return values stay the same while
unexpected exceptions are no longer swallowed.

Signed-off-by: Old-Ding <ai.neo.ae86@gmail.com>
@Old-Ding Old-Ding force-pushed the codex/python-return-finally-warnings branch from 4bc62ce to a9e6460 Compare July 8, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: CI Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants