Skip to content

Conversation

sl0thentr0py
Copy link
Member

Description

when async generators throw a GeneratorExit we end up with

ValueError: <Token var=<ContextVar name='current_scope' default=None at 0x7f04cf05fb50> at 0x7f04ceb17340> was created in a different Context

so just catch that and rely on GC to cleanup the contextvar since we can't be smarter than that anyway for this case.

Issues

@sl0thentr0py sl0thentr0py requested a review from a team as a code owner October 15, 2025 13:02
Copy link

linear bot commented Oct 15, 2025

@sl0thentr0py sl0thentr0py force-pushed the neel/scope-handle-value-error branch from ec930da to 2c27210 Compare October 15, 2025 13:03
@sl0thentr0py sl0thentr0py force-pushed the neel/scope-handle-value-error branch from 2c27210 to 66da709 Compare October 15, 2025 13:05
@sl0thentr0py sl0thentr0py enabled auto-merge (squash) October 15, 2025 13:05
@sl0thentr0py sl0thentr0py merged commit 4325802 into master Oct 15, 2025
111 of 112 checks passed
@sl0thentr0py sl0thentr0py deleted the neel/scope-handle-value-error branch October 15, 2025 13:17
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.

Using isolation scopes with multiple depths of generators causes Token was created in different Context error

2 participants