Repository navigation
fix(js/ts/python): preserve cancelled cleanup and generic unit callbacks - #5062
Merged
Merged
Conversation
Contributor
Python Type Checking Results (Pyright)
|
| File | Errors | Status |
|---|---|---|
temp/tests/Python/fable_modules/thoth_json_core/codec.py |
2 |
Excluded files with errors (4 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_hash_set.py |
18 | Excluded |
temp/tests/Python/test_applicative.py |
12 | Excluded |
temp/tests/Python/test_nested_and_recursive_pattern.py |
2 | Excluded |
temp/tests/Python/fable_modules/thoth_json_python/encode.py |
2 | Excluded |
dbrattli
force-pushed
the
fix/async-cleanup-generic-continuations
branch
2 times, most recently
from
October 13, 2026 22:16
3ac4b9f to
e82b304
Compare
dbrattli
marked this pull request as ready for review
October 13, 2026 23:00
dbrattli
force-pushed
the
fix/async-cleanup-generic-continuations
branch
from
October 15, 2026 19:11
18ce662 to
efe486d
Compare
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.
Why
JS/TypeScript and Python
Async.TryFinallycan skip cleanup with an already-cancelled token. EagerUsingbinders can also enter a cancelled resource body before disposal is protected.Python generic
Async.FromContinuationsexposes a success callback requiring a value even when unit specialization emitsok().Relationship to earlier fixes
UsingandTryFinally; correct listener lifecycle alone does not ensure cleanup is installed before cancellation can terminate a computation.FromContinuationshas a statically knownAsync<unit>result. Its genericfromValue ()regression passes a value and preserves an argument. A helper returningAsync<'T>can instead receive a callback that invokesok ()with no argument: the helper still selects the generic runtime path, leaving both runtime arity and callable annotations mismatched.TryFinallycancellation check could still bypass handler installation, andUsingstill evaluated its binder before disposal was protected. Downstream continuation exceptions could also re-enter finalization; preventing duplicate timer settlement did not guard finalization itself.This PR adds coverage for those composition boundaries: pre-cancelled finalization, nested finalization, cancellation during resource acquisition, downstream continuation failures, and generic callbacks specialized to unit.
How
TryFinallywith an already-cancelled token, run only the outer cleanup without entering the inner computation, matching .NET.