Skip to content

gen: Expliclty track contextvars, fixing contextvars.reset#2938

Merged
bdarnell merged 1 commit intotornadoweb:masterfrom
bdarnell:contextvars
Oct 20, 2020
Merged

gen: Expliclty track contextvars, fixing contextvars.reset#2938
bdarnell merged 1 commit intotornadoweb:masterfrom
bdarnell:contextvars

Conversation

@bdarnell
Copy link
Member

The asyncio event loop provides enough contextvars support out of the
box for basic contextvars functionality to work in tornado coroutines,
but not contextvars.reset. Prior to this change, each yield created
a new "level" of context, when an entire coroutine should be on the
same level. This is necessary for the reset method to work.

Fixes #2731

@bdarnell bdarnell force-pushed the contextvars branch 5 times, most recently from ea8432f to 05cc896 Compare October 18, 2020 00:08
The asyncio event loop provides enough contextvars support out of the
box for basic contextvars functionality to work in tornado coroutines,
but not `contextvars.reset`. Prior to this change, each yield created
a new "level" of context, when an entire coroutine should be on the
same level. This is necessary for the reset method to work.

Fixes tornadoweb#2731
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.

ValueError with ContextVar reset within decorated coroutine

1 participant