2018-01-04 0:44 GMT+01:00 Victor Stinner <victor.stin...@gmail.com>:
> The behaviour is more tricky than what I expected. While running
> context.run(), the context object is out of sync of the "current
> context". It's only synchronized again at run() exit. So
> ContextVar.set() doesn't immediately modifies the "current context"
> object (set by Context.run()).

A better description of Context.run() behaviour would be:

"Create a copy of the context and sets it as the current context. Once
the function completes, updates the context from the copy."

This description explains why run() doesn't immediately updates the
context object.

Victor
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to