Skip to content

Allow isolating tinyio Loops#21

Open
aburgm wants to merge 3 commits intopatrick-kidger:devfrom
aburgm:armin/isolate
Open

Allow isolating tinyio Loops#21
aburgm wants to merge 3 commits intopatrick-kidger:devfrom
aburgm:armin/isolate

Conversation

@aburgm
Copy link

@aburgm aburgm commented Feb 16, 2026

So that an exception in an isolated group of coroutines does not propagate to "outer" coroutines.

This is a follow-up of #20 against the dev branch.

This allows to isolate them from each other so that an exception in a
nested group does not affect coroutines running outside.
Copy link
Owner

@patrick-kidger patrick-kidger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit aside LGTM!

Do you want to try this in your downstream use-case + confirm that it works there, before we merge it here? Then we can be sure that this isn't missing some detail.

Actually also, I think I've thought of an even neater API:

try:
    return (yield from _nest(...)), True
except BaseException as e:
    return e, False

and then the consuming code can do more complicated logic on the exception. Would that be preferable do you think?

- the first element is either the result of `fn(*args)` or `cleanup(exception)`.
- whether `fn(*args)` succeeded or failed.
"""
if args:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, if len(args) > 0 in the spirit of no-implicit-bool.

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.

2 participants