Skip to content

[Python] Fix async await in branches and cast in closures#4341

Merged
dbrattli merged 2 commits intomainfrom
dbrattli/fable-python-bugs
Feb 10, 2026
Merged

[Python] Fix async await in branches and cast in closures#4341
dbrattli merged 2 commits intomainfrom
dbrattli/fable-python-bugs

Conversation

@dbrattli
Copy link
Collaborator

Summary

  • Fix missing await in async functions when return is inside if/else, match, try/with, or loops — wrapReturnWithAwait is now recursive
  • Fix UnboundLocalError caused by cast() reassigning variables inside closures — disabled makeCastStatement since isinstance() already narrows for Pyright

@github-actions
Copy link

github-actions bot commented Feb 10, 2026

Python Type Checking Results (Pyright)

Metric Value
Total errors 13
Files with errors 2
Excluded files 2
New errors ✅ No
Excluded files with errors (2 files)

These files have known type errors and are excluded from CI. Remove from pyrightconfig.ci.json as errors are fixed.

File Errors Status
temp/tests/Python/test_applicative.py 12 Excluded
temp/tests/Python/fable_modules/thoth_json_python/encode.py 1 Excluded

@dbrattli dbrattli merged commit e4d4878 into main Feb 10, 2026
23 checks passed
@dbrattli dbrattli deleted the dbrattli/fable-python-bugs branch February 10, 2026 18:55
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.

1 participant