[Python-Dev] PEP 550 v4: coroutine policy
Antoine Pitrou
antoine at python.org
Tue Aug 29 16:33:00 EDT 2017
Le 29/08/2017 à 22:20, Yury Selivanov a écrit :
>
> 2)
>
> gvar = new_context_var()
> var = new_context_var()
>
> async def bar():
> # EC = [current_thread_LC_copy, Task_foo_LC_copy, Task_wait_for_LC]
Ah, thanks!... That explains things, though I don't expect most users
to spontaneously infer this and its consequences from the fact that they
used "wait_for()".
This seems actually even more problematic, because if bar() can mutate
Task_wait_for_LC, it may unwillingly affect wait_for() (assuming the
wait_for() implementation may some day use EC for whatever purpose, e.g.
logging).
It seems framework code like wait_for() should have a way to override
the default behaviour and remove their own LC's from "child" coroutines'
lookup chaines. Perhaps the PEP already allows for his?
Regards
Antoine.
More information about the Python-Dev
mailing list