Skip to content

Procedure return interrupts#147

Merged
newville merged 2 commits intomasterfrom
procedure_return_interrupts
Dec 11, 2025
Merged

Procedure return interrupts#147
newville merged 2 commits intomasterfrom
procedure_return_interrupts

Conversation

@newville
Copy link
Copy Markdown
Member

This fixes #146, a problem introduced when fixing #141 with #142. In that fix, we flagged "return" statements as interrrupts to a while/for/etc block.

But, when running a asteval-defined function/procedure, a return statement must not interrupt calling code - say, calling the procedure in a block.

This fix simply unsets asteval._interrupt - the flag that a loop-interrupt has happened - when a procedure/function returns.

Added a test based on example at #146. Thanks @sergproua!

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.4%. Comparing base (bda05fd) to head (1984dbf).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@          Coverage Diff           @@
##           master    #147   +/-   ##
======================================
  Coverage    95.3%   95.4%           
======================================
  Files           4       4           
  Lines        2171    2182   +11     
======================================
+ Hits         2070    2082   +12     
+ Misses        101     100    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@newville newville merged commit 1169b51 into master Dec 11, 2025
31 checks passed
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.

Unreachable statements inside for and while loops

1 participant