Liran Nuna <liran...@gmail.com> added the comment:

> You should try to use the contextvars module that was specifically created to 
> handle local context state (for tasks & coroutines).

Yury, from my original report:

> I'm aware that this particular problem could be solved with the new context 
> variables introduced with python3.7, however it is just a simplification of 
> our actual issue.

Not everything can use context managers. Imagine the context manager is 
mock.patch used in testing and you want to run two tests in "parallel", each 
with a different mocked method. mock.patch isn't aware of `await` so patching 
will be incorrect.

Those are just some behaviors where context variables don't solve the issue I'm 
describing.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33918>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to