]> git.ipfire.org Git - thirdparty/tornado.git/commit
gen: Expliclty track contextvars, fixing contextvars.reset 2938/head
authorBen Darnell <ben@cockroachlabs.com>
Fri, 16 Oct 2020 19:29:20 +0000 (15:29 -0400)
committerBen Darnell <ben@cockroachlabs.com>
Sun, 18 Oct 2020 00:11:34 +0000 (20:11 -0400)
commit629d091a92d2586d8a5dbb4d266b1972e3a1c4c0
tree0bc83ff74766c0b2ee36519771d48d28826bc33d
parent5913aa43ecfdaa76876fc57867062227b907b1dd
gen: Expliclty track contextvars, fixing contextvars.reset

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
tornado/gen.py
tornado/test/gen_test.py